kubernetes添加删除重启节点
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添加删除重启节点的更多相关文章
- centos8平台redis cluster集群添加/删除node节点(redis5.0.7)
一,当前redis cluster的node情况: 我们的添加删除等操作都是以这个cluster作为demo cluster采用六台redis,3主3从 redis1 : ip: 172.17.0.2 ...
- Hadoop 添加删除数据节点(datanode)
前提条件: 添加机器安装jdk等,最好把环境都搞成一样,示例可做相应改动 实现目的: 在hadoop集群中添加一个新增数据节点. 1. 创建目录和用户 mkdir -p /app/hadoop gr ...
- redis cluster中添加删除重分配节点例子
redis cluster配置好,并运行一段时间后,我们想添加节点,或者删除节点,该怎么办呢. 一,redis cluster命令行 //集群(cluster) CLUSTER INFO 打 ...
- redis cluster 添加 删除 重分配 节点
redis cluster配置好,并运行一段时间后,我们想添加节点,或者删除节点,该怎么办呢. 一,redis cluster命令 //集群(cluster) CLUSTER INFO 打印集群的信 ...
- angular.js ng-repeat动态插入删除dom节点
既然上面提到 angular.js 下无需用户直接操作dom ,而是在编译间断 dom 与 控制层model 实现了双向绑定,一方做出改变,另一方就会立即改变,那问题来了,我想插入一个文本框和按钮,并 ...
- angular.js 动态插入删除dom节点
angular.js 是新一代web开发框架,它轻松在web前端实现了MVC模式,相比 jquery 模式,这种新玩意竟然不需要开发者直接去操作dom . 作为前端开发而不去操作dom ,这简直是一个 ...
- Hadoop 添加删除Slave
Hadoop 添加删除Slave @(Hadoop) 在hdfs-site.xml文件中添加如下配置: <property> <name>dfs.hosts</name& ...
- 节点操作-创建并添加&删除节点&替换&克隆节点
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" ...
- redis集群添加删除节点
Redis3.0集群添加节点 1:首先把需要添加的节点启动 cd /usr/local/cluster/ mkdir 7006 cp /usr/local/cluster/redis.conf /u ...
随机推荐
- 解决下载经过GZip压缩后的网页乱码问题
目前很多网站默认采用GZip压缩,如果不进行解压缩,下载后生成的html页面打开后会出现中文乱码 乱码前: string url = "http://quote.eastmoney.com/ ...
- 【maven】之使用import scope解决maven继承(单)问题
想必大家在做SpringBoot应用的时候,都会有如下代码: <parent> <groupId>org.springframework.boot</groupId> ...
- 【模态窗口-Modeldialog】提交请求时禁止在新窗口打开页面的处理方法
在使用Window.ShowModalDialog()打开模态窗口后,在模态窗口内提交时总是会在新窗口中打开. 解决办法: 在要弹出的窗口的<head>之间加: <base targ ...
- MyBatis 对数据库进行CRUD操作
1.update修改 uodate修改也可以使用之前的机制在配置文件中直接编写sql 但是update语句的set字句中是根据传入的值决定的, 此时可以通过Mybatis提供的标签实现判断动态拼接up ...
- CentOS7安装配置PostgreSQL9.6
本文涉及CentOS7下PostgreSQL9.6的yum安装,访问配置及简单使用. 一.验证环境 1. 操作系统 CentOS-7-x86_64-Everything-1511 2. Postgre ...
- python 数组或列表维度增加
怎么把[,,,,]变成[[],[],[],[],[]]???
- CSS自定义滚动条样式
原文地址:http://www.qianduan.net/css-custom-scroll-bar-style/ 相信很多人都遇到过在设计中自定义滚动条样式的情景,之前我都是努力说服设计师接受浏览器 ...
- 数据仓库与ODS
1. 引言 本篇主要讲述操作数据存储(ODS)系统产生的背景.定义.特点,以及它与数据仓库的区别.在前两篇,笔者介绍了什么是数据仓库?为什么需要数据仓库?数据仓库系统的体系结构是什么?因此可能在读者心 ...
- ArcMap VBA实现连续编号
连续编号VBA部分:Static lCount as longlCount=lCount+1赋值部分:lCount (从1开始)lCount-1 (从0开始)
- JDK1.6 Java.lang.Null.Pointer.Exception
先来看一下JDK1.6的API: NullPointerException (Java Platform SE 6) public class NullPointerException extends ...