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. PHP 获取url里文件的扩展名

    PHP 获取url地址中文件的扩展名 $url = 'http://www.abc.com/ab/cd/e.php?id=1&data=2#laowen';echo pathinfo( par ...

  2. ALGO-117_蓝桥杯_算法训练_友好数

    问题描述 有两个整数,如果每个整数的约数和(除了它本身以外)等于对方,我们就称这对数是友好的.例如: 9的约数和有:+= 4的约数和有:+= 所以9和4不是友好的. 220的约数和有: = 284的约 ...

  3. Maven 专题

    目录: Maven的安装 Eclipse安装Maven插件 Nexus私服搭建 Maven+Nexus配置 发布自己的构件(至Nexus) 创建maven多模块工程group 整理中[...] 先放一 ...

  4. (转载)关于java多线程web服务器 以及相关资料转载

    1.自己实现的简单的java多线程web服务器: https://blog.csdn.net/chongshangyunxiao321/article/details/51095149 自己实现一个简 ...

  5. IE6/7 单选按钮 radio 无法选中解决方法

    原文地址:http://blog.sina.com.cn/s/blog_74d6cedd0100ugih.html 今天在做一个页面,居然ff没问题,ie6/7上浏览的时候radio单选按钮不能被选中 ...

  6. centos7开启端口(永久--permanent)

    1.运行命令:firewall-cmd --get-active-zones运行完成之后,可以看到zone名称,如下: 2.执行如下命令命令: firewall-cmd --zone=public - ...

  7. Linux下rz,sz与ssh的配合使用

    Linux下rz,sz与ssh的配合使用 一般来说,linux服务器大多是通过ssh客户端来进行远程的登陆和管理的,使用ssh登陆linux主机以后,如何能够快速的和本地机器进行文件的交互呢,也就是上 ...

  8. java下载excel,excel从数据库获取数据

    <!-- poi --> <dependency> <groupId>org.apache.poi</groupId> <artifactId&g ...

  9. Android7.0对dlopen的改变——读取私有.so结果变化

    两个内存段 在同一个进程空间中dlopen一个.so文件,理论上在内存中是同一片区域,但实际调试中发现Android7.0(read "/proc/self/maps")中,先后读 ...

  10. Web api Json 接受的参数类型为父类,自动序列化为子类的过程

    场景: public abstract class JsonCreationConverter<T> : JsonConverter { /// <summary> /// t ...