1.添加节点

(master)查看目前节点

[root@k8s-master ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-master Ready master 153m v1.14.0
k8s-node1 Ready <none> 117m v1.14.0
[root@k8s-master ~]#

clone k8s在执行kubeadm init命令前时的状态机器,修改ip,修改主机名

node2上操作

hostnamectl set-hostname k8s-node2
reboot

添加k8s-node2节点(node2上操作)

[root@k8s-node2 ~]# echo  > /proc/sys/net/ipv4/ip_forward
[root@k8s-node2 ~]# kubeadm join 192.168.111.130: --token ymtl8s.933t59qfezi9gjcq --discovery-token-ca-cert-hash sha256:7816d0b2572e6c569ed8e63ece15a7a08d06ed3fc89698245bf2aaa6acc345d7
[preflight] Running pre-flight checks
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
[kubelet-start] Downloading configuration for the kubelet from the "kubelet-config-1.14" ConfigMap in the kube-system namespace
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Activating the kubelet service
[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap... This node has joined the cluster:
* Certificate signing request was sent to apiserver and a response was received.
* The Kubelet was informed of the new secure connection details. Run 'kubectl get nodes' on the control-plane to see this node join the cluster.

master上查看是否成功添加

[root@k8s-master ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-master Ready master 178m v1.14.0
k8s-node1 Ready <none> 142m v1.14.0
k8s-node2 Ready <none> 27s v1.14.0
root@k8s-master ~]# kubectl get po --all-namespaces -o wide ##-o查看pod运行在那个node上,--namespace=kube-system查看系统pod
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
kube-system coredns-fb8b8dccf-ltlx4 / Running 3h12m 10.244.0.4 k8s-master <none> <none>
kube-system coredns-fb8b8dccf-q949f / Running 3h12m 10.244.0.5 k8s-master <none> <none>
kube-system etcd-k8s-master / Running 3h11m 192.168.111.130 k8s-master <none> <none>
kube-system kube-apiserver-k8s-master / Running 3h12m 192.168.111.130 k8s-master <none> <none>
kube-system kube-controller-manager-k8s-master / Running 3h11m 192.168.111.130 k8s-master <none> <none>
kube-system kube-flannel-ds-amd64-2gr2v / Running 177m 192.168.111.130 k8s-master <none> <none>
kube-system kube-flannel-ds-amd64-bsrkx / Running 157m 192.168.111.131 k8s-node1 <none> <none>
kube-system kube-flannel-ds-amd64-xdg5p / Running 15m 192.168.111.132 k8s-node2 <none> <none>
kube-system kube-proxy-2mj4q / Running 157m 192.168.111.131 k8s-node1 <none> <none>
kube-system kube-proxy-ffd8s / Running 15m 192.168.111.132 k8s-node2 <none> <none>
kube-system kube-proxy-qp5k7 / Running 3h12m 192.168.111.130 k8s-master <none> <none>
kube-system kube-scheduler-k8s-master / Running 3h12m 192.168.111.130 k8s-master <none> <none>
[root@k8s-master ~]#

2.删除节点

master上执行

kubectl drain k8s-node2 --delete-local-data --force --ignore-daemonsets
kubectl delete node k8s-node2

node2上执行

kubeadm reset

3.节点重启

无需特别操作,保证节点kubelet是开机启动就行

systemctl enable kubelet

systemctl restart kubelet 或者 service kubelet start

kubernetes添加删除重启节点的更多相关文章

  1. centos8平台redis cluster集群添加/删除node节点(redis5.0.7)

    一,当前redis cluster的node情况: 我们的添加删除等操作都是以这个cluster作为demo cluster采用六台redis,3主3从 redis1 : ip: 172.17.0.2 ...

  2. Hadoop 添加删除数据节点(datanode)

    前提条件: 添加机器安装jdk等,最好把环境都搞成一样,示例可做相应改动 实现目的: 在hadoop集群中添加一个新增数据节点. 1. 创建目录和用户  mkdir -p /app/hadoop gr ...

  3. redis cluster中添加删除重分配节点例子

    redis cluster配置好,并运行一段时间后,我们想添加节点,或者删除节点,该怎么办呢. 一,redis cluster命令行     //集群(cluster)  CLUSTER INFO 打 ...

  4. redis cluster 添加 删除 重分配 节点

    redis cluster配置好,并运行一段时间后,我们想添加节点,或者删除节点,该怎么办呢.  一,redis cluster命令 //集群(cluster) CLUSTER INFO 打印集群的信 ...

  5. angular.js ng-repeat动态插入删除dom节点

    既然上面提到 angular.js 下无需用户直接操作dom ,而是在编译间断 dom 与 控制层model 实现了双向绑定,一方做出改变,另一方就会立即改变,那问题来了,我想插入一个文本框和按钮,并 ...

  6. angular.js 动态插入删除dom节点

    angular.js 是新一代web开发框架,它轻松在web前端实现了MVC模式,相比 jquery 模式,这种新玩意竟然不需要开发者直接去操作dom . 作为前端开发而不去操作dom ,这简直是一个 ...

  7. Hadoop 添加删除Slave

    Hadoop 添加删除Slave @(Hadoop) 在hdfs-site.xml文件中添加如下配置: <property> <name>dfs.hosts</name& ...

  8. 节点操作-创建并添加&删除节点&替换&克隆节点

    <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" ...

  9. redis集群添加删除节点

    Redis3.0集群添加节点 1:首先把需要添加的节点启动 cd /usr/local/cluster/ mkdir 7006 cp /usr/local/cluster/redis.conf  /u ...

随机推荐

  1. Python单元测试框架之pytest 1 ---如何执行测试用例

    From: https://www.cnblogs.com/fnng/p/4765112.html 介绍   pytest是一个成熟的全功能的Python测试工具,可以帮助你写出更好的程序. 适合从简 ...

  2. JIRA 资源

    https://www.**.com/article/2015/8/7/22532.html e_v_g_e_t JIRA使用教程:在Windows上安装JIRAJIRA使用教程:在Linux上安装J ...

  3. Eclipse/MyEclipse向HDFS中如创建文件夹等操作报错permission denied解决办法

    不多说,直接上干货! 问题现象 当执行创建文件的的时候, 即: String Path = "hdfs://host2:9000"; FileSystem fileSystem = ...

  4. java1.8新特性(四 创建 stream对象)

    java1.8 提供了 stream对象 可以用作 对 集合 数组的 一系列操作,都是基于lambda 表达式 ,所以得先熟悉lambda 表达式 集合创建stream对象 // 1.集合创建stre ...

  5. [转][CentOS]修改IP后立即生效

    来自:http://bbs.51cto.com/thread-789908-1.html Linux系统里修改IP地址后该如何使之即刻生效,有两种方法可以解决: (1) sudo ifdown eth ...

  6. 认识hasLayout——IE浏览器css bug的一大罪恶根源

     原文地址:http://neverned.blog.163.com/blog/static/1265524200933021130561/   什么是hasLayout?hasLayout是IE特有 ...

  7. tesseract-ocr4.0 安装部署及训练验证码识别

    1.  下载最新版本的leptonica,  leptonica-1.74.1.tar.gz   2. 编译安装 tar -zxvf leptonica-.tar.gz cd leptonica- . ...

  8. 以太网安全技术ACL原理+配置

    一.以太网访问控制列表 主要作用:在整个网络中分布实施接入安全性 访问控制列表ACL(Access Control List)为网络设备提供了基本的服务安全性.对某个服务而言,安全管理员首先应该考虑的 ...

  9. VMware上centos系统忘记账号和密码解决

    转载: https://blog.csdn.net/wyx_wyl/article/details/78246907 我们有时会忘记虚拟机上的登陆密码,今天来说一下怎样修改我们的密码.应该对大多数的l ...

  10. [UE4]子弹穿透多个机器人

    一.将机器人的碰撞类型改成“OverLap” 二.使用“MultiLineTraceByChannel”这个是可以穿透检测,可以检测到多个物体(前提是被检测物体的碰撞类型是“OverLap”).“Li ...