ipv4/ip_forward contents are not set to 1 echo “1” > /proc/sys/net/ipv4/ip_forward [ERROR DirAvailable–var-lib-etcd...]: /var/lib/etcd is not empty rm -rf /var/lib/etcd failed to load Kubelet config file /var/lib/kubelet
]: /etc/kubernetes/manifests/etcd.yaml already exists [ERROR Port-10250]: Port 10250 is in use...2379]: Port 2379 is in use [ERROR Port-2380]: Port 2380 is in use [ERROR DirAvailable--var-lib-etcd...]: /var/lib/etcd is not empty [preflight] If you know what you are doing, you can make a check non-fatal.../lib/kubelet" [reset] deleting contents of stateful directories: [/var/lib/etcd /var/lib/kubelet /etc.../cni/net.d /var/lib/dockershim /var/run/kubernetes] [reset] deleting contents of config directories:
/kubelet/ /var/lib/kubelet-bak 删除 kubelet 客户端证书: ➜ rm /var/lib/kubelet/pki/kubelet-client* 然后在 master1...y 现在我们使用下面的命令来重新初始化控制平面节点,但是最重要的一点是要使用 etcd 的数据目录,可以通过 --ignore-preflight-errors=DirAvailable--var-lib-etcd...➜ kubeadm init --config kubeadm.yaml --ignore-preflight-errors=DirAvailable--var-lib-etcd [init] Using...Kubernetes version: v1.22.8 [preflight] Running pre-flight checks [WARNING DirAvailable--var-lib-etcd...]: /var/lib/etcd is not empty [preflight] Pulling images required for setting up a Kubernetes cluster
kube-system get cm kubeadm-config -o yaml' [kubelet-start] Writing kubelet configuration to file "/var.../lib/kubelet/config.yaml" [kubelet-start] Writing kubelet environment file with flags to file "/var/lib...]: /etc/kubernetes/manifests/etcd.yaml already exists [ERROR Port-10250]: Port 10250 is in use...2379]: Port 2379 is in use [ERROR Port-2380]: Port 2380 is in use [ERROR DirAvailable--var-lib-etcd...]: /var/lib/etcd is not empty [preflight] If you know what you are doing, you can make a check non-fatal
2379]: Port 2379 is in use [ERROR Port-2380]: Port 2380 is in use [ERROR DirAvailable--var-lib-etcd...]: /var/lib/etcd is not empty [preflight] If you know what you are doing, you can make a check non-fatal.../ca" certificate and key [certs] Generating "etcd/server" certificate and key [certs] etcd/server serving...scheduler.conf" kubeconfig file [kubelet-start] Writing kubelet environment file with flags to file "/var.../lib/kubelet/kubeadm-flags.env" [kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet
,恢复数据需要恢复到etcd的数据目录,目录一般都是在 /var/lib/etcd ,先停etcd服务,然后把数据目录删除,进行数据恢复,最后启动etcd服务。.../lib/kubelet/* -name cache* /var/lib/kubelet/pods/29767367-c535-491d-b1c0-beaaff531849/plugins/kubernetes.io...~empty-dir/cache-volume /var/lib/kubelet/pods/29767367-c535-491d-b1c0-beaaff531849/volumes/kubernetes.io...~empty-dir/cache-volume cd /var/lib/kubelet/pods/29767367-c535-491d-b1c0-beaaff531849/volumes/kubernetes.io...~empty-dir/cache-volume root@k8s-node3:/var/lib/kubelet/pods/29767367-c535-491d-b1c0-beaaff531849/volumes
-1.el7.x86_64.rpm MASTER_ADDRESS=$1 sed -i 's/User=etcd//g' /usr/lib/systemd/system/etcd.service echo...==============' cat /etc/etcd/etcd.conf #[member] ETCD_NAME=default ETCD_DATA_DIR="/var/lib/etcd.../lib/kubelet mkdir -p /var/log/kubernetes echo '===================Config kubelet... ===============...logs" will not work if you set this flag. # NODE_PORT="--port=10250" # --hostname-override="": If non-empty...KUBE_CFG_DIR}/proxy file===================" cat ${KUBE_CFG_DIR}/proxy # --hostname-override="": If non-empty
resources: {} volumeMounts: - mountPath: /var/lib/etcd name: etcd-data -.../lib/etcd/ 3、启动新etcd节点,指定–data-dir=/var/lib/etcd/ etcd节点扩展 节点名 IP 备注 infra0 172.16.154.81 初始节点,k8s的master.../lib/etcd/ 注:执行上述命令需要机器上有etcdctl 上述命令执行成功会将快照中的数据存放到/var/lib/etcd目录中 3、在infra1节点启动etcd 将如下yaml放入/etc...节点加入集群重复上述操作;注意在加入集群之前,将之前/var/lib/etcd/的数据删除。...rm /var/lib/etcd/ -rf # 因为这是个扩展节点,需要同步etcd0的数据,所以把它自己数据删掉 vim ..
/lib/etcd/ ExecStart=/home/anakin/bin/etcd \ --name=192.168.32.131 \ --listen-client-urls=http://.../lib/etcd Restart=on-failure RestartSec=5 LimitNOFILE=65536 [Install] WantedBy=multi-user.target 然后执行以下命令...: cp etcd.service /lib/systemd/system/ systemctl enable etcd.service mkdir -p /var/lib/etcd service etcd...[Install] WantedBy=multi-user.target 然后执行和启动etcd类似的命令 cp kube-apiserver.service /lib/systemd/system/.../run/calico:/var/run/calico \ -v /lib/modules:/lib/modules \ -v /run/docker/plugins:/run/docker/plugins
/var/lib/etcd/ && mkdir -p /etc/etcd/ 4、编辑节点node-3配置文件 注: 重要的事情说三遍:修改/etc/etcd/etcd.conf文件要先删除/var...重要的事情说三遍:修改/etc/etcd/etcd.conf文件要先删除/var/lib/etcd目录下保存的数据,再重新启用 服务,不然失败。...重要的事情说三遍:修改/etc/etcd/etcd.conf文件要先删除/var/lib/etcd目录下保存的数据,再重新启用 服务,不然失败 。...="etcd03" #2.设置数据保存的目录 ETCD_DATA_DIR="/var/lib/etcd" #3.用于监听其他etcd member的url ETCD_LISTEN_PEER_URLS...cd /var/lib/etcd && rm -rf * 注3:集群ip地址变化后,除了修改/etc/etcd/etcd.conf 文件并重新启用服务外,还需要删除/var/lib/etcd目 录下保存的数据
mkdir -p /etc/etcd vim /etc/etcd/etcd.conf # [member] ETCD_NAME=etcd1 ETCD_DATA_DIR="/var/lib/etcd" ETCD_LISTEN_PEER_URLS...://192.168.1.11:2379" 创建etcd.service配置文件 etcd.service的变量都是引用etcd配置文件中 mkdir /var/lib/etcd vim /usr/lib...:2380,etcd3=https://192.168.1.13:2380 \ --initial-cluster-state=new \ --data-dir=/var/lib/etcd Restart...etcd.conf与/var/lib/systemd/system/etcd.service两个配置文件,且etcd.service引用了etcd.conf重定义的变量。...//192.168.1.13:2380 \ --initial-cluster-state=new \ --data-dir=/var/lib/etcd Restart=on-failure RestartSec
和etcd容器 备份当前数据 mv /etc/kubernetes/manifests /etc/kubernetes/manifests.bak mv /var/lib/etcd /var/lib/etcd.bak...$ ansible etcd -m shell -a "mv /var/lib/etcd/default.etcd /var/lib/etcd/default.etcd.bak" 数据恢复 (需要拷贝当前的备份数据到其余的节点...--initial-advertise-peer-urls=https://192.168.56.11:2380 --data-dir=/var/lib/etcd/default.etcd # etcd...--initial-advertise-peer-urls=https://192.168.56.12:2380 --data-dir=/var/lib/etcd/default.etcd # etcd...--initial-advertise-peer-urls=https://192.168.56.13:2380 --data-dir=/var/lib/etcd/default.etcd 启动etcd
# 删除etcd相关文件 rm -rf /var/lib/etcd/* rm -rf /etc/default/etcd # 设置时区 ln -snf /usr/share/zoneinfo/Asia... <<EOF ETCD_NAME=$name ETCD_DATA_DIR="/var/lib/etcd/" ETCD_LISTEN_PEER_URLS="http://$ETCD_Server:2380.../passwd|grep etcd|wc -l\` -eq 0 ];then mkdir -p /var/lib/etcd && useradd -g 217 -u 111 etcd -d /var/lib...chown -R etcd:etcd /var/lib/etcd systemctl restart etcd.service #netstat -anpt | grep 2379 # 查看版本 etcdctl...如果需要清空etcd的值,使用以下命令 rm -rf /var/lib/etcd/member/* 重启etcd service etcd restart 查看etcd的所有的值,其中 --endpoints
]# cp -ar /data/etcd/ /var/lib/ [root@node1 ~]# ll /var/lib/etcd/ total 0 drwx------. 4 root root 29...v3.3.12 ETCD_DATA_DIR=/var/lib/etcd 3.修改启动参数 [root@node1 ~]# vim /usr/local/bin/etcd #!...\ -v /etc/ssl/certs:/etc/ssl/certs:ro \ -v /etc/ssl/etcd/ssl:/etc/ssl/etcd/ssl:ro \ -v /var/lib.../etcd:/var/lib/etcd:rw \ --memory=0 \ --blkio-weight=1000 \ --name=etcd1 \ quay.io/coreos/etcd...ssl/etcd/ssl:ro -v /var...
stop && rm -fr /var/lib/etcd/* 2....停止worker节点的所有服务 service kubelet stop rm -fr /var/lib/kubelet/* service kube-proxy stop rm -fr /var...master节点设置 1. etcd设置 编辑/lib/systemd/system/etcd.service,内容如下: [Unit] Description=Etcd Server After=network.target.../lib/etcd/ ExecStart=/home/anakin/bin/etcd \ --name=192.168.32.131 \ --listen-client-urls=https:/.../run/calico:/var/run/calico \ -v /lib/modules:/lib/modules \ -v /run/docker/plugins:/run/docker/plugins
旧ETCD环境数据备份 备份V2: etcdctl backup --data-dir /var/lib/etcd --backup-dir /opt/etcdv2 注:此处的数据目录为: /var/...数据目录下 unzip /opt/etcdv2 && mv /opt/etcdv2/member /var/lib/etcd/infra1.etcd/ 2.启动新节点(new-01节点) 因为备份的数据中...# configure file for etcd.service # [member] ETCD_NAME=infra1 ETCD_DATA_DIR="/var/lib/etcd/infra1.etcd...file for etcd.service # [member] ETCD_NAME=infra2 ETCD_DATA_DIR="/var/lib/etcd/infra2.etcd" ETCD_LISTEN_PEER_URLS...ETCD_DATA_DIR="/var/lib/etcd/infra3.etcd" ETCD_LISTEN_PEER_URLS="http://10.94.19.181:2380" ETCD_LISTEN_CLIENT_URLS
写在前面 在传统的运维部署中,需求增量上线的时,会备份应用和应用数据,保证升级失败也可以回滚,同时,定期数据备份也是容灾的一种手段,如K8s中etcd的定期快照备份,当K8s集群和etcd集群因为不可控原因全部死掉之后...,除非有etcd备份,否则只能重置集群环境了。.../lib/mysql] └─$mysql -uroot Welcome to the MariaDB monitor....4 rows in set (0.00 sec) MariaDB [(none)]> use test Database changed MariaDB [test]> show tables; Empty...lib/mysql" db=mysql [ !
创建systemd服务 设定etcd配置文件 建立相关目录 $ mkdir -p /var/lib/etcd/ $ mkdir -p /opt/etcd/config/ 创建etcd配置文件 $ cat...<<EOF | sudo tee /opt/etcd/config/etcd.conf #节点名称 ETCD_NAME=$(hostname -s) #数据存放位置 ETCD_DATA_DIR=/var.../lib/etcd EOF 创建systemd配置文件 $ cat <<EOF | sudo tee /etc/systemd/system/etcd.service [Unit] Description...rmdir dir1 若目录不空,会报错: $ etcdctl set /dir/testkey hi hi $ etcdctl rmdir /dir Error: 108: Directory not empty...$ etcdctl backup --data-dir /var/lib/etcd --backup-dir /home/etcd_backup 支持的选项包括: --data-dir etcd的数据目录
ETCD_NAME="etcd1"ETCD_DATA_DIR="/var/lib/etcd/default.etcd"ETCD_LISTEN_PEER_URLS="https://192.168.10.103...:加入集群的当前状态,new是新集群,existing表示加入已有集群2.5.5 创建服务配置文件mkdir -p /etc/etcd/sslmkdir -p /var/lib/etcd/default.etcdcd...[Service]Type=notifyEnvironmentFile=-/etc/etcd/etcd.confWorkingDirectory=/var/lib/etcd/ExecStart=/usr...节点创建目录mkdir -p /etc/etcdmkdir -p /etc/etcd/sslmkdir -p /var/lib/etcd/default.etcd服务配置文件,需要修改etcd节点名称及.../etcd.conf#[Member]ETCD_NAME="etcd2"ETCD_DATA_DIR="/var/lib/etcd/default.etcd"ETCD_LISTEN_PEER_URLS="
领取专属 10元无门槛券
手把手带您无忧上云