.查看 Docker 使用的 cgroup driver:
root@ubuntu:/home/ubuntu# docker info | grep -i cgroup
Cgroup Driver: cgroupfs
WARNING: No swap limit support
root@ubuntu:/home/ubuntu#
root@ubuntu:/etc/apt# cat > /etc/sysctl.d/k8s.conf << EOF > net.bridge.bridge-nf-call-ip6tables = 1 > net.bridge.bridge-nf-call-iptables = 1 > EOF root@ubuntu:/etc/apt# sysctl -p root@ubuntu:/etc/apt#
1. 關閉swap並關閉防火牆 首先,我們需要先關閉swap和防火牆,否則在安裝Kubernetes時會導致不成功: # 臨時關閉 swapoff -a # 編輯/etc/fstab,注釋掉包含swap的那一行即可,重啟后可永久關閉 ufw disable
阿里雲
https://my.oschina.net/u/2306127/blog/3226348
https://www.cnblogs.com/g2thend/p/11616534.html
安裝 kubeadm, kubelet and kubectl # root(sudo -i) apt-get update && apt-get install -y apt-transport-https curl -s https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | apt-key add - cat <<EOF >/etc/apt/sources.list.d/kubernetes.list deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main EOF apt-get update apt-get install -y kubelet kubeadm kubectl
清華
https://mirrors.tuna.tsinghua.edu.cn/help/kubernetes/
裝kubernetes的時候,需要安裝kubelet, kubeadm等包,但k8s官網給的yum源是packages.cloud.google.com,國內訪問不了,此時我們可以使用yum倉庫鏡像。 簡單摸索了下,如下設置可用(centos)。注意不要開啟check。 cat <<EOF > /etc/yum.repos.d/kubernetes.repo [kubernetes] name=Kubernetes baseurl=http://mirrors.huaweicloud.com/kubernetes/yum/repos/kubernetes-el7-x86_64 enabled=1 gpgcheck=0 repo_gpgcheck=0 gpgkey=http://mirrors.huaweicloud.com/kubernetes/yum/doc/yum-key.gpg http://mirrors.huaweicloud.com/kubernetes/yum/doc/rpm-package-key.gpg EOF 不過華為雲跟kubernetes同步不太及時,例如現在是1.8.1了,但是華為雲還是1.7.5。 如果你用的是ubuntu,也可以試試ustc的mirror,更新比較及時。 cat <<EOF > /etc/apt/sources.list.d/kubernetes.list deb http://mirrors.ustc.edu.cn/kubernetes/apt kubernetes-xenial main EOF
參考 https://wiki.linuxchina.net/index.php/Install_and_Configure_Kubernetes_(k8s)_on_debian10
#國內版 cat <<EOF >/etc/apt/sources.list.d/kubernetes.list deb https://mirrors.huaweicloud.com/kubernetes/apt/ kubernetes-xenial main EOF apt install gnupg -y curl -s https://mirrors.huaweicloud.com/kubernetes/apt/doc/apt-key.gpg | sudo apt-key add - #4、更新索引文件並安裝kubernetes sudo apt update sudo apt install -y kubeadm kubelet kubectl
root@ubuntu:/etc# kubelet --version Kubernetes v1.18.5 root@ubuntu:/etc#
root@ubuntu:/etc/apt# command -v kubeadm /usr/bin/kubeadm root@ubuntu:/etc/apt#
root@ubuntu:/etc/apt# kubeadm config images list W1013 16:19:53.622125 27106 configset.go:348] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io] k8s.gcr.io/kube-apiserver:v1.19.2 k8s.gcr.io/kube-controller-manager:v1.19.2 k8s.gcr.io/kube-scheduler:v1.19.2 k8s.gcr.io/kube-proxy:v1.19.2 k8s.gcr.io/pause:3.2 k8s.gcr.io/etcd:3.4.13-0 k8s.gcr.io/coredns:1.7.0 root@ubuntu:/etc/apt#
root@ubuntu:/etc/apt# kubectl version Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.2", GitCommit:"f5743093fd1c663cb0cbc89748f730662345d44d", GitTreeState:"clean", BuildDate:"2020-09-16T13:41:02Z", GoVersion:"go1.15", Compiler:"gc", Platform:"linux/arm64"} The connection to the server localhost:8080 was refused - did you specify the right host or port? root@ubuntu:/etc/apt# netstat -lpn | grep 8080
執行 kubeadm init
z
root@ubuntu:/etc/apt# kubeadm init W1013 16:31:39.817318 30403 configset.go:348] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io] [init] Using Kubernetes version: v1.19.2 [preflight] Running pre-flight checks [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/ error execution phase preflight: [preflight] Some fatal errors occurred: [ERROR Swap]: running with swap on is not supported. Please disable swap [preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...` To see the stack trace of this error execute with --v=5 or higher root@ubuntu:/etc/apt#
root@ubuntu:/etc/apt# kubeadm init --cri-socket /run/containerd/containerd.sock --pod-network-cidr=10.244.0.0/16 W1013 16:54:51.338546 38143 configset.go:348] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io] [init] Using Kubernetes version: v1.19.2 [preflight] Running pre-flight checks error execution phase preflight: [preflight] Some fatal errors occurred: [ERROR CRI]: container runtime is not running: output: time="2020-10-13T16:54:51+08:00" level=fatal msg="getting status of runtime failed: rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.RuntimeService" , error: exit status 1 [preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...` To see the stack trace of this error execute with --v=5 or higher root@ubuntu:/etc/apt#
Run mkdir -p /etc/containerd && containerd config default > /etc/containerd/config.toml
and then restart containerd
( fyi, i just made this change in kind - https://github.com/kubernetes-sigs/kind/pull/425/files )
Then you can run the crictl
like so (to test):
kubernetes-sigs/kind#425 (comment)
sudo apt-get update && sudo apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl
The kubelet is now restarting every few seconds, as it waits in a crashloop for kubeadm to tell it what to do.
Configure cgroup driver used by kubelet on control-plane node
When using Docker, kubeadm will automatically detect the cgroup driver for the kubelet and set it in the /var/lib/kubelet/config.yaml
file during runtime.
If you are using a different CRI, you must pass your cgroupDriver
value to kubeadm init
, like so:
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
cgroupDriver: <value>
For further details, please read Using kubeadm init with a configuration file.
Please mind, that you only have to do that if the cgroup driver of your CRI is not cgroupfs
, because that is the default value in the kubelet already.
Note: Since--cgroup-driver
flag has been deprecated by kubelet, if you have that in/var/lib/kubelet/kubeadm-flags.env
or/etc/default/kubelet
(/etc/sysconfig/kubelet
for RPMs), please remove it and use the KubeletConfiguration instead (stored in/var/lib/kubelet/config.yaml
by default).
Restarting the kubelet is required:
systemctl daemon-reload
systemctl restart kubelet
The automatic detection of cgroup driver for other container runtimes like CRI-O and containerd is work in progress
3. 安裝kubeadm、kubelet、kubectl
https://blog.csdn.net/liukuan73/article/details/83116271
root@ubuntu:/home/ubuntu# dpkg -l | grep kube hi kubeadm 1.14.2-00 arm64 Kubernetes Cluster Bootstrapping Tool hi kubectl 1.14.2-00 arm64 Kubernetes Command Line Tool hi kubelet 1.14.2-00 arm64 Kubernetes Node Agent ii kubernetes-cni 0.7.5-00 arm64 Kubernetes CNI root@ubuntu:/home/ubuntu#
root@ubuntu:/etc/apt# apt-get install -y kubelet=1.14.2-00 kubeadm=1.14.2-00 kubectl=1.14.2-00 -f Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: kubeadm : Depends: kubernetes-cni (= 0.7.5) kubelet : Depends: kubernetes-cni (= 0.7.5)
root@ubuntu:/etc/apt# apt-get install kubernetes-cni=0.7.5-00 ----最好是把舊的刪除 Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required:
root@ubuntu:/etc/apt# apt-get install -y kubelet=1.14.2-00 kubeadm=1.14.2-00 kubectl=1.14.2-00 Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: golang-1.10-go golang-1.10-src golang-src Use 'sudo apt autoremove' to remove them. The following NEW packages will be installed: kubeadm kubectl kubelet 0 upgraded, 3 newly installed, 0 to remove and 152 not upgraded. Need to get 33.9 MB of archives. After this operation, 201 MB of additional disk space will be used. Get:1 https://mirrors.aliyun.com/kubernetes/apt kubernetes-xenial/main arm64 kubelet arm64 1.14.2-00 [19.1 MB] Get:2 https://mirrors.aliyun.com/kubernetes/apt kubernetes-xenial/main arm64 kubectl arm64 1.14.2-00 [7,683 kB] Get:3 https://mirrors.aliyun.com/kubernetes/apt kubernetes-xenial/main arm64 kubeadm arm64 1.14.2-00 [7,137 kB] Fetched 33.9 MB in 3s (10.2 MB/s) Selecting previously unselected package kubelet. (Reading database ... 100325 files and directories currently installed.) Preparing to unpack .../kubelet_1.14.2-00_arm64.deb ... Unpacking kubelet (1.14.2-00) ... Selecting previously unselected package kubectl. Preparing to unpack .../kubectl_1.14.2-00_arm64.deb ... Unpacking kubectl (1.14.2-00) ... Selecting previously unselected package kubeadm. Preparing to unpack .../kubeadm_1.14.2-00_arm64.deb ... Unpacking kubeadm (1.14.2-00) ... Setting up kubelet (1.14.2-00) ... Created symlink /etc/systemd/system/multi-user.target.wants/kubelet.service → /lib/systemd/system/kubelet.service. Setting up kubectl (1.14.2-00) ... Setting up kubeadm (1.14.2-00) ... root@ubuntu:/etc/apt#
root@ubuntu:/etc/apt# apt-mark hold kubelet=1.14.2-00 kubeadm=1.14.2-00 kubectl=1.14.2-00 kubelet set on hold. kubeadm set on hold. kubectl set on hold. root@ubuntu:/etc/apt# systemctl enable kubelet && sudo systemctl start kubelet
#!/bin/bash images=(kube-proxy:v1.14.2 kube-scheduler:v1.14.2 kube-controller-manager:v1.14.2 kube-apiserver:v1.14.2 etcd:3.2.24 pause:3.1 coredns:1.2.2) for imageName in ${images[@]} ; do docker pull anjia0532/google-containers.$imageName docker tag anjia0532/google-containers.$imageName k8s.gcr.io/$imageName docker rmi anjia0532/google-containers.$imageName done
3.1 apt安裝
3.1.1 創建kubernetes的repo
創建kubernetes的source文件:
sudo apt-get update && sudo apt-get install -y apt-transport-https curl
sudo curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo tee /etc/apt/sources.list.d/kubernetes.list <<-'EOF'
deb https://mirrors.aliyun.com/kubernetes/apt kubernetes-xenial main
EOF
sudo apt-get update
google地址被牆的情況下可以使用阿里雲或者中科大的鏡像站:
sudo apt-get update && sudo apt-get install -y apt-transport-https curl
sudo curl -s https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | sudo apt-key add -
sudo tee /etc/apt/sources.list.d/kubernetes.list <<-'EOF'
deb https://mirrors.aliyun.com/kubernetes/apt kubernetes-xenial main
EOF
sudo apt-get update
備注:
雖然我的ubuntu版本是18.04.1(bionic),但k8s的apt包目前還沒支持到這么高,使用xenial。
3.1.2 安裝kubeadm、kubelet、kubectl
1.查看可用軟件版本:
$ apt-cache madison kubeadm
kubeadm | 1.12.1-00 | https://mirrors.aliyun.com/kubernetes/apt kubernetes-xenial/main amd64 Packages
kubeadm | 1.12.0-00 | https://mirrors.aliyun.com/kubernetes/apt kubernetes-xenial/main amd64 Packages
kubeadm | 1.11.3-00 | https://mirrors.aliyun.com/kubernetes/apt kubernetes-xenial/main amd64 Packages
......
2.安裝指定版本:
$ sudo apt-get install -y kubelet=1.12.0-00 kubeadm=1.12.0-00 kubectl=1.12.0-00
$ sudo apt-mark hold kubelet=1.12.0-00 kubeadm=1.12.0-00 kubectl=1.12.0-00
3.設置開機自啟動並運行kubelet:
sudo systemctl enable kubelet && sudo systemctl start kubelet
[kubelet-check] Initial timeout of 40s passed. [kubelet-check] It seems like the kubelet isn't running or healthy. [kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get http://localhost:10248/healthz: dial tcp [::1]:10248: connect: connection refused. [kubelet-check] It seems like the kubelet isn't running or healthy. [kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get http://localhost:10248/healthz: dial tcp [::1]:10248: connect: connection refused. [kubelet-check] It seems like the kubelet isn't running or healthy. [kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get http://localhost:10248/healthz: dial tcp [::1]:10248: connect: connection refused. [kubelet-check] It seems like the kubelet isn't running or healthy. [kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get http://localhost:10248/healthz: dial tcp [::1]:10248: connect: connection refused. [kubelet-check] It seems like the kubelet isn't running or healthy. [kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get http://localhost:10248/healthz: dial tcp [::1]:10248: connect: connection refused.
1.your configuration file uses an old API spec: "kubeadm.k8s.io/v1alpha2".
執行kubeadm init --config /etc/kubernetes/kubeadm-master.config --ignore-preflight-errors=all報錯
apiVersion: kubeadm.k8s.io/v1alpha3 kind: MasterConfiguration
2.The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get http://localhost:10248/healthz: dial tcp [::1]:10248: connect: connection refused.
[root@localhost kubernetes]# vi /etc/systemd/system/kubelet.service.d/10-kubeadm.conf Environment="KUBELET_SYSTEM_PODS_ARGS=--pod-manifest-path=/etc/kubernetes/manifests --allow-privileged=true --fail-swap-on=false" [root@localhost kubernetes]# systemctl daemon-reload [root@localhost kubernetes]# systemctl restart kubelet
3./etc/kubernetes/manifests/kube-apiserver.yaml already exists
rm -rf /etc/kubernetes/manifests
4.kubectl get pod狀態為ErrImagePull && ImagePullBackOff ErrImageNeverPull,請確保node上有相應的鏡像,沒有則在node機器上進行docker pull,且deployment中imagePullPolicy:IfNotPresent
/etc/kubernetes/manifests
root@ubuntu:/etc/kubernetes/manifests# ls etcd.yaml kube-controller-manager.yaml kube-apiserver.yaml kube-scheduler.yaml root@ubuntu:/etc/kubernetes/manifests# cat kube-apiserver.yaml | grep ubuntu
mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config
root@ubuntu:~# /usr/bin/kubelet I1013 21:50:18.614161 51136 server.go:417] Version: v1.14.2 I1013 21:50:18.614683 51136 plugins.go:103] No cloud provider specified. W1013 21:50:18.614730 51136 server.go:556] standalone mode, no API client W1013 21:50:18.907694 51136 server.go:474] No api server defined - no events will be sent to API server. I1013 21:50:18.907732 51136 server.go:625] --cgroups-per-qos enabled, but --cgroup-root was not specified. defaulting to /
安裝基礎組件
- 啟用NET.BRIDGE.BRIDGE-NF-CALL-IPTABLES內核選項。
sysctl -w net.bridge.bridge-nf-call-iptables=1
- 禁用交換分區。
swapoff -a
cp -p /etc/fstab /etc/fstab.bak$(date '+%Y%m%d%H%M%S')
sed -i "s/\/dev\/mapper\/centos-swap/\#\/dev\/mapper\/centos-swap/g" /etc/fstab
- 安裝K8s組件。
yum install -y kubelet kubeadm kubectl kubernetes-cni
- 查看安裝情況。
rpm -qa | grep kubelet
rpm -qa | grep kubeadm
rpm -qa | grep kubectl
rpm -qa | grep kubernetes-cni
- 設置iptables。
echo "net.bridge.bridge-nf-call-iptables=1" > /etc/sysctl.d/k8s.conf
- 使能kubelet服務。
systemctl enable kubelet
卸載K8s組件 注意: 下列步驟僅僅指導用戶如何手動卸載K8s組件,請勿在正常的部署過程中執行。 清空K8s集群設置。 在卸載K8s組件前,先執行kubeadm reset命令,清空K8s集群設置。 卸載管理組件。 yum erase -y kubelet kubectl kubeadm kubernetes-cni 刪除基礎組件鏡像。 基礎組件通過Docker鏡像部署,因此只需要強制刪除對應鏡像即可卸載。 docker rmi -f k8s.gcr.io/kube-apiserver:v1.15.1 docker rmi -f k8s.gcr.io/kube-controller-manager:v1.15.1 docker rmi -f k8s.gcr.io/kube-scheduler:v1.15.1 docker rmi -f k8s.gcr.io/kube-proxy:v1.15.1 docker rmi -f k8s.gcr.io/pause:3.1 docker rmi -f k8s.gcr.io/etcd:3.3.10 docker rmi -f k8s.gcr.io/coredns:1.3.1
root@ubuntu:/home/ubuntu# ps -elf | grep kube 0 S root 8550 28697 0 80 0 - 35475 futex_ 22:25 pts/4 00:00:00 kubeadm init --apiserver-advertise-address=10.10.16.82 --pod-network-cidr=172.16.0.0/16 --service-cidr=10.233.0.0/16 --kubernetes-version=v1.15.2 0 S root 9311 7563 0 80 0 - 1097 pipe_w 22:27 pts/5 00:00:00 grep --color=auto kube root@ubuntu:/home/ubuntu#
kubeadm init 報錯如下: [kubelet-check] It seems like the kubelet isn't running or healthy. [kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10255/healthz' failed with error: Get http://localhost:10255/healthz: dial tcp 127.0.0.1:10255: getsockopt: connection refused. 解決辦法: Things were solved by setting --fail-swap-on=false in the systemd script. Just make the modification on the file /etc/systemd/system/kubelet.service.d/10-kubeadm.conf Environment="KUBELET_SYSTEM_PODS_ARGS=--pod-manifest-path=/etc/kubernetes/manifests --allow-privileged=true --fail-swap-on=false"
安裝成功后
root@ubuntu:~# ls /etc/kubernetes/ manifests root@ubuntu:~# ls /etc/systemd/system/kubelet.service.d 10-kubeadm.conf root@ubuntu:~# ls /etc/systemd/system/kubelet.service ls: cannot access '/etc/systemd/system/kubelet.service': No such file or directory root@ubuntu:~# ls /etc/systemd/system/kubelet.service
root@ubuntu:/home/ubuntu# cat /etc/systemd/system/kubelet.service.d/10-kubeadm.conf # Note: This dropin only works with kubeadm and kubelet v1.11+ [Service] Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf" Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml" # This is a file that "kubeadm init" and "kubeadm join" generates at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env # This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use # the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file. EnvironmentFile=-/etc/default/kubelet ExecStart= ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS
kubeadm reset -f rm -rf ~/.kube/ rm -rf /etc/kubernetes/ rm -rf /etc/systemd/system/kubelet.service.d rm -rf /etc/systemd/system/kubelet.service
root@ubuntu:/home/ubuntu# ls /etc/systemd/system/kubelet.service.d/ 10-kubeadm.conf root@ubuntu:/home/ubuntu# kubectl get node NAME STATUS ROLES AGE VERSION ubuntu Ready master 8m1s v1.18.1 root@ubuntu:/home/ubuntu# kubectl get pods No resources found in default namespace. root@ubuntu:/home/ubuntu# kubectl get pods --all-namespaces NAMESPACE NAME READY STATUS RESTARTS AGE kube-system coredns-66bff467f8-bw6bv 1/1 Running 0 8m10s kube-system coredns-66bff467f8-tptcm 1/1 Running 0 8m10s kube-system etcd-ubuntu 1/1 Running 0 8m20s kube-system kube-apiserver-ubuntu 1/1 Running 0 8m20s kube-system kube-controller-manager-ubuntu 1/1 Running 0 8m20s kube-system kube-flannel-ds-arm64-cn6gb 1/1 Running 0 2m49s kube-system kube-proxy-ffr44 1/1 Running 0 8m10s kube-system kube-scheduler-ubuntu 1/1 Running 0 8m20s root@ubuntu:/home/ubuntu#
總結:
源
root@ubuntu:~# cat /etc/apt/sources.list.d/kubernetes.list deb https://mirrors.aliyun.com/kubernetes/apt kubernetes-xenial main root@ubuntu:~#
暫時不支持kata
kubeadm init --kubernetes-version=v1.18.1 --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=10.10.16.82 mkdir -p $HOME/.kube cp -i /etc/kubernetes/admin.conf $HOME/.kube/config chown $(id -u):$(id -g) $HOME/.kube/config
加上
--image-repository registry.aliyuncs.com/google_containers有問題
kubeadm init --kubernetes-version=v1.18.1 --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=10.10.16.82 --image-repository registry.aliyuncs.com/google_containers
root@ubuntu:~# kubectl create -f kube-flannel.yml podsecuritypolicy.policy/psp.flannel.unprivileged created clusterrole.rbac.authorization.k8s.io/flannel created clusterrolebinding.rbac.authorization.k8s.io/flannel created serviceaccount/flannel created configmap/kube-flannel-cfg created daemonset.apps/kube-flannel-ds-amd64 created daemonset.apps/kube-flannel-ds-arm64 created daemonset.apps/kube-flannel-ds-arm created daemonset.apps/kube-flannel-ds-ppc64le created daemonset.apps/kube-flannel-ds-s390x created root@ubuntu:~# kubectl get pods --all-namespaces NAMESPACE NAME READY STATUS RESTARTS AGE kube-system coredns-66bff467f8-dg454 1/1 Running 0 4m46s kube-system coredns-66bff467f8-mxrp4 1/1 Running 0 4m46s kube-system etcd-ubuntu 1/1 Running 0 4m55s kube-system kube-apiserver-ubuntu 1/1 Running 0 4m55s kube-system kube-controller-manager-ubuntu 1/1 Running 0 4m55s kube-system kube-flannel-ds-arm64-mlw5f 1/1 Running 0 76s kube-system kube-proxy-ktzjc 1/1 Running 0 4m46s kube-system kube-scheduler-ubuntu 1/1 Running 0 4m55s root@ubuntu:~#
root@ubuntu:~# kubectl get cs NAME STATUS MESSAGE ERROR scheduler Healthy ok controller-manager Healthy ok etcd-0 Healthy {"health":"true"} root@ubuntu:~#
重置:
step1
systemctl stop kubelet docker rm -f $(docker ps -aq) kubeadm reset -f rm -rf ~/.kube/ rm -rf /etc/kubernetes/ #rm -rf /etc/systemd/system/kubelet.service.d #rm -rf /etc/systemd/system/kubelet.service
root@ubuntu:~# ip link del dev flannel.1 root@ubuntu:~# ip link del dev cni0
step2