Ubuntu安装k8s单节点参见:ubuntu18.04使用kubeadm部署k8s单节点

注意:在参照上面文章进行操作时,可能会出现如下问题:
①执行apt-get -y install apt-transport-https ca-certificates curl software-properties-common安装工具包时,出现没有要安装的候选包,可以先执行apt-get -y update更新后,再进行单独安装

# 安装工具包,出现Package 'software-properties-common' has no installation candidate
root@xxx:~# apt-get -y install apt-transport-https ca-certificates curl software-properties-common
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'apt' instead of 'apt-transport-https'
Package software-properties-common is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'software-properties-common' has no installation candidate
root@xxx:~# 


root@xxx:~# curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | apt-key add -
OK
root@xxx:~# 
root@xxx:~# add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"

Command 'add-apt-repository' not found, but can be installed with:

apt install software-properties-common


# 单独安装software-properties-common,还是不行
root@xxx:~# apt install software-properties-common
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package software-properties-common is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'software-properties-common' has no installation candidate
root@xxx:~# apt install software-properties-common
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package software-properties-common is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'software-properties-common' has no installation candidate
root@xxx:~# apt-get -y install software-properties-common
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package software-properties-common is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'software-properties-common' has no installation candidate

# 需要先执行apt-get -y update更新后,再进行单独安装
root@xxx:~# apt-get -y update
Get:1 http://mirrors.cloud.aliyuncs.com/ubuntu bionic InRelease [242 kB]
Get:2 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:3 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:4 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security InRelease [88.7 kB]
Get:5 http://mirrors.cloud.aliyuncs.com/ubuntu bionic/universe Sources [9,051 kB]
Get:6 http://mirrors.cloud.aliyuncs.com/ubuntu bionic/restricted Sources [5,324 B]
Get:7 http://mirrors.cloud.aliyuncs.com/ubuntu bionic/main Sources [829 kB]
Get:8 http://mirrors.cloud.aliyuncs.com/ubuntu bionic/multiverse Sources [181 kB]
Get:9 http://mirrors.cloud.aliyuncs.com/ubuntu bionic/main amd64 Packages [1,019 kB]
Get:10 http://mirrors.cloud.aliyuncs.com/ubuntu bionic/main i386 Packages [1,007 kB]
Get:11 http://mirrors.cloud.aliyuncs.com/ubuntu bionic/main Translation-en [516 kB]
Get:12 http://mirrors.cloud.aliyuncs.com/ubuntu bionic/restricted amd64 Packages [9,184 B]
Get:13 http://mirrors.cloud.aliyuncs.com/ubuntu bionic/restricted i386 Packages [9,156 B]
Get:14 http://mirrors.cloud.aliyuncs.com/ubuntu bionic/restricted Translation-en [3,584 B]
Get:15 http://mirrors.cloud.aliyuncs.com/ubuntu bionic/universe amd64 Packages [8,570 kB]
Get:16 http://mirrors.cloud.aliyuncs.com/ubuntu bionic/universe i386 Packages [8,531 kB]
Get:17 http://mirrors.cloud.aliyuncs.com/ubuntu bionic/universe Translation-en [4,941 kB]
Get:18 http://mirrors.cloud.aliyuncs.com/ubuntu bionic/multiverse i386 Packages [144 kB]
Get:19 http://mirrors.cloud.aliyuncs.com/ubuntu bionic/multiverse amd64 Packages [151 kB]
Get:20 http://mirrors.cloud.aliyuncs.com/ubuntu bionic/multiverse Translation-en [108 kB]
Get:21 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/multiverse Sources [15.9 kB]
Get:22 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/restricted Sources [24.5 kB]
Get:23 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/universe Sources [466 kB]
Get:24 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/main Sources [519 kB]
Get:25 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/main i386 Packages [1,387 kB]
Get:26 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/main amd64 Packages [2,328 kB]
Get:27 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/main Translation-en [448 kB]
Get:28 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/restricted i386 Packages [29.9 kB]
Get:29 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/restricted amd64 Packages [559 kB]
Get:30 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/restricted Translation-en [76.4 kB]
Get:31 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/universe i386 Packages [1,592 kB]
Get:32 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/universe amd64 Packages [1,771 kB]
Get:33 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/universe Translation-en [383 kB]
Get:34 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/multiverse amd64 Packages [27.3 kB]
Get:35 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/multiverse i386 Packages [11.6 kB]
Get:36 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/multiverse Translation-en [6,808 B]
Get:37 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-backports/main Sources [5,440 B]
Get:38 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-backports/universe Sources [5,360 B]
Get:39 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-backports/main amd64 Packages [10.0 kB]
Get:40 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-backports/main i386 Packages [10.0 kB]
Get:41 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-backports/main Translation-en [4,764 B]
Get:42 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-backports/universe i386 Packages [10.3 kB]
Get:43 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-backports/universe amd64 Packages [10.3 kB]
Get:44 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-backports/universe Translation-en [4,588 B]
Get:45 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security/restricted Sources [21.7 kB]
Get:46 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security/universe Sources [290 kB]
Get:47 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security/main Sources [258 kB]
Get:48 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security/main i386 Packages [1,080 kB]
Get:49 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security/main amd64 Packages [1,983 kB]
Get:50 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security/main Translation-en [355 kB]
Get:51 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security/restricted i386 Packages [23.2 kB]
Get:52 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security/restricted amd64 Packages [535 kB]
Get:53 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security/restricted Translation-en [72.4 kB]
Get:54 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security/universe amd64 Packages [1,156 kB]
Get:55 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security/universe i386 Packages [1,001 kB]
Get:56 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security/universe Translation-en [265 kB]
93% [16 Packages store 0 B]                                                                                                                8,071 kB/s 0s
Fetched 52.3 MB in 11s (4,740 kB/s)                                                                                                                     
Reading package lists... Done

root@xxx:~# apt-get -y install software-properties-common
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  python3-software-properties unattended-upgrades
Suggested packages:
  bsd-mailx needrestart
The following NEW packages will be installed:
  python3-software-properties software-properties-common unattended-upgrades
0 upgraded, 3 newly installed, 0 to remove and 96 not upgraded.
Need to get 75.6 kB of archives.
After this operation, 762 kB of additional disk space will be used.
Get:1 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/main amd64 python3-software-properties all 0.96.24.32.18 [23.8 kB]
Get:2 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/main amd64 software-properties-common all 0.96.24.32.18 [10.1 kB]
Get:3 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates/main amd64 unattended-upgrades all 1.1ubuntu1.18.04.14 [41.7 kB]
Fetched 75.6 kB in 0s (7,315 kB/s)        
Preconfiguring packages ...
Selecting previously unselected package python3-software-properties.
(Reading database ... 110367 files and directories currently installed.)
Preparing to unpack .../python3-software-properties_0.96.24.32.18_all.deb ...
Unpacking python3-software-properties (0.96.24.32.18) ...
Selecting previously unselected package software-properties-common.
Preparing to unpack .../software-properties-common_0.96.24.32.18_all.deb ...
Unpacking software-properties-common (0.96.24.32.18) ...
Selecting previously unselected package unattended-upgrades.
Preparing to unpack .../unattended-upgrades_1.1ubuntu1.18.04.14_all.deb ...
Unpacking unattended-upgrades (1.1ubuntu1.18.04.14) ...
Setting up unattended-upgrades (1.1ubuntu1.18.04.14) ...

Creating config file /etc/apt/apt.conf.d/50unattended-upgrades with new version
Created symlink /etc/systemd/system/multi-user.target.wants/unattended-upgrades.service → /lib/systemd/system/unattended-upgrades.service.
Synchronizing state of unattended-upgrades.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable unattended-upgrades
Setting up python3-software-properties (0.96.24.32.18) ...
Setting up software-properties-common (0.96.24.32.18) ...
Processing triggers for systemd (237-3ubuntu10.47) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for dbus (1.12.2-1ubuntu1.2) ...
Processing triggers for ureadahead (0.100.0-21) ...
root@xxx:~# add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
Get:1 http://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic InRelease [64.4 kB]
Hit:2 http://mirrors.cloud.aliyuncs.com/ubuntu bionic InRelease
Get:3 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-updates InRelease [88.7 kB]                                        
Hit:4 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-backports InRelease              
Get:5 http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security InRelease [88.7 kB]     
Get:6 http://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages [21.8 kB]
Fetched 264 kB in 1s (499 kB/s)                                
Reading package lists... Done

②初始化k8s时,出现 [ERROR NumCPU]: the number of available CPUs 1 is less than the required 2,参考 kubadm init error CPUs 1 is less than required 2。解决方式,在原命令的基础上,在末尾添加--ignore-preflight-errors=NumCPU以忽略CPU数量限制(安装k8s默认至少2核CPU,2GB内存)。

# 使用kubeadm初始化k8s出现[ERROR NumCPU]: the number of available CPUs 1 is less than the required 2
root@xxx:/etc/docker# kubeadm init \
>   --kubernetes-version=v1.15.4 \
>   --image-repository registry.aliyuncs.com/google_containers \
>   --pod-network-cidr=10.24.0.0/16 \
>   --ignore-preflight-errors=Swap
[init] Using Kubernetes version: v1.15.4
[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 NumCPU]: the number of available CPUs 1 is less than the required 2
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
root@xxx:/etc/docker# 

# 添加--ignore-preflight-errors=NumCPU以忽略CPU限制
root@xxx:/etc/docker# kubeadm init   --kubernetes-version=v1.15.4   --image-repository registry.aliyuncs.com/google_containers   --pod-network-cidr=10.24.0.0/16   --ignore-preflight-errors=Swap --ignore-preflight-errors=NumCPU
[init] Using Kubernetes version: v1.15.4
[preflight] Running pre-flight checks
        [WARNING NumCPU]: the number of available CPUs 1 is less than the required 2
        [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/
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
[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/config.yaml"
[kubelet-start] Activating the kubelet service
[certs] Using certificateDir folder "/etc/kubernetes/pki"
[certs] Generating "ca" certificate and key
[certs] Generating "apiserver" certificate and key
[certs] apiserver serving cert is signed for DNS names [k8s-master kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.xx.xx.1 172.17.xx.xxx]
[certs] Generating "apiserver-kubelet-client" certificate and key
[certs] Generating "front-proxy-ca" certificate and key
[certs] Generating "front-proxy-client" certificate and key
[certs] Generating "etcd/ca" certificate and key
[certs] Generating "apiserver-etcd-client" certificate and key
[certs] Generating "etcd/healthcheck-client" certificate and key
[certs] Generating "etcd/server" certificate and key
[certs] etcd/server serving cert is signed for DNS names [k8s-master localhost] and IPs [172.17.xx.xxx127.0.0.1 ::1]
[certs] Generating "etcd/peer" certificate and key
[certs] etcd/peer serving cert is signed for DNS names [k8s-master localhost] and IPs [172.17.xx.xxx 127.0.0.1 ::1]
[certs] Generating "sa" key and public key
[kubeconfig] Using kubeconfig folder "/etc/kubernetes"
[kubeconfig] Writing "admin.conf" kubeconfig file
[kubeconfig] Writing "kubelet.conf" kubeconfig file
[kubeconfig] Writing "controller-manager.conf" kubeconfig file
[kubeconfig] Writing "scheduler.conf" kubeconfig file
[control-plane] Using manifest folder "/etc/kubernetes/manifests"
[control-plane] Creating static Pod manifest for "kube-apiserver"
[control-plane] Creating static Pod manifest for "kube-controller-manager"
[control-plane] Creating static Pod manifest for "kube-scheduler"
[etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests"
[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s
[kubelet-check] Initial timeout of 40s passed.
[apiclient] All control plane components are healthy after 42.502467 seconds
[upload-config] Storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace
[kubelet] Creating a ConfigMap "kubelet-config-1.15" in namespace kube-system with the configuration for the kubelets in the cluster
[upload-certs] Skipping phase. Please see --upload-certs
[mark-control-plane] Marking the node k8s-master as control-plane by adding the label "node-role.kubernetes.io/master=''"
[mark-control-plane] Marking the node k8s-master as control-plane by adding the taints [node-role.kubernetes.io/master:NoSchedule]
[bootstrap-token] Using token: 8gpze3.kozwjsj0x0zhk85r
[bootstrap-token] Configuring bootstrap tokens, cluster-info ConfigMap, RBAC Roles
[bootstrap-token] configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials
[bootstrap-token] configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token
[bootstrap-token] configured RBAC rules to allow certificate rotation for all node client certificates in the cluster
[bootstrap-token] Creating the "cluster-info" ConfigMap in the "kube-public" namespace
[addons] Applied essential addon: CoreDNS
[addons] Applied essential addon: kube-proxy

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  https://kubernetes.io/docs/concepts/cluster-administration/addons/

Then you can join any number of worker nodes by running the following on each as root:

kubeadm join 172.17.xx.xxx:6443 --token 8gpze3.kozwjsj0x0zhk85r \
    --discovery-token-ca-cert-hash sha256:406e0c20e5b7073b38774f9d573cac82af3afdce9e887217386a3598bc74e1d5 
root@xxx:/etc/docker# journalctl -u kubelet -f-- Logs begin at Tue 2021-06-01 13:47:17 CST. --
Dec 13 19:21:55 k8s-master kubelet[25624]: I1213 19:21:55.050342   25624 reconciler.go:203] operationExecutor.VerifyControllerAttachedVolume started for volume "lib-modules" (UniqueName: "kubernetes.io/host-path/4bc3c4b4-432b-4e1b-9f87-e0fbe6f34635-lib-modules") pod "kube-proxy-hqlzp" (UID: "4bc3c4b4-432b-4e1b-9f87-e0fbe6f34635")
Dec 13 19:21:55 k8s-master kubelet[25624]: I1213 19:21:55.050951   25624 reconciler.go:203] operationExecutor.VerifyControllerAttachedVolume started for volume "kube-proxy" (UniqueName: "kubernetes.io/configmap/4bc3c4b4-432b-4e1b-9f87-e0fbe6f34635-kube-proxy") pod "kube-proxy-hqlzp" (UID: "4bc3c4b4-432b-4e1b-9f87-e0fbe6f34635")
Dec 13 19:21:55 k8s-master kubelet[25624]: I1213 19:21:55.051176   25624 reconciler.go:203] operationExecutor.VerifyControllerAttachedVolume started for volume "kube-proxy-token-xdzvj" (UniqueName: "kubernetes.io/secret/4bc3c4b4-432b-4e1b-9f87-e0fbe6f34635-kube-proxy-token-xdzvj") pod "kube-proxy-hqlzp" (UID: "4bc3c4b4-432b-4e1b-9f87-e0fbe6f34635")
Dec 13 19:21:55 k8s-master kubelet[25624]: I1213 19:21:55.051343   25624 reconciler.go:203] operationExecutor.VerifyControllerAttachedVolume started for volume "xtables-lock" (UniqueName: "kubernetes.io/host-path/4bc3c4b4-432b-4e1b-9f87-e0fbe6f34635-xtables-lock") pod "kube-proxy-hqlzp" (UID: "4bc3c4b4-432b-4e1b-9f87-e0fbe6f34635")
Dec 13 19:21:55 k8s-master kubelet[25624]: I1213 19:21:55.148688   25624 kuberuntime_manager.go:928] updating runtime config through cri with podcidr 10.24.0.0/24
Dec 13 19:21:55 k8s-master kubelet[25624]: I1213 19:21:55.149294   25624 docker_service.go:353] docker cri received runtime config &RuntimeConfig{NetworkConfig:&NetworkConfig{PodCidr:10.24.0.0/24,},}
Dec 13 19:21:55 k8s-master kubelet[25624]: I1213 19:21:55.149655   25624 kubelet_network.go:77] Setting Pod CIDR:  -> 10.24.0.0/24
Dec 13 19:21:55 k8s-master kubelet[25624]: E1213 19:21:55.150706   25624 kubelet.go:2173] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
Dec 13 19:21:58 k8s-master kubelet[25624]: W1213 19:21:58.851863   25624 cni.go:213] Unable to update cni config: No networks found in /etc/cni/net.d
Dec 13 19:21:59 k8s-master kubelet[25624]: E1213 19:21:59.489732   25624 kubelet.go:2173] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
Dec 13 19:22:03 k8s-master kubelet[25624]: I1213 19:22:03.683159   25624 transport.go:132] certificate rotation detected, shutting down client connections to start using new credentials
Dec 13 19:22:03 k8s-master kubelet[25624]: W1213 19:22:03.852067   25624 cni.go:213] Unable to update cni config: No networks found in /etc/cni/net.d
Dec 13 19:22:04 k8s-master kubelet[25624]: E1213 19:22:04.502414   25624 kubelet.go:2173] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
Dec 13 19:22:08 k8s-master kubelet[25624]: W1213 19:22:08.852621   25624 cni.go:213] Unable to update cni config: No networks found in /etc/cni/net.d
Dec 13 19:22:09 k8s-master kubelet[25624]: E1213 19:22:09.503929   25624 kubelet.go:2173] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
Dec 13 19:22:13 k8s-master kubelet[25624]: W1213 19:22:13.852823   25624 cni.go:213] Unable to update cni config: No networks found in /etc/cni/net.d
Dec 13 19:22:14 k8s-master kubelet[25624]: E1213 19:22:14.508402   25624 kubelet.go:2173] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
Dec 13 19:22:18 k8s-master kubelet[25624]: W1213 19:22:18.853014   25624 cni.go:213] Unable to update cni config: No networks found in /etc/cni/net.d
Dec 13 19:22:19 k8s-master kubelet[25624]: E1213 19:22:19.509974   25624 kubelet.go:2173] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
Dec 13 19:22:23 k8s-master kubelet[25624]: W1213 19:22:23.853222   25624 cni.go:213] Unable to update cni config: No networks found in /etc/cni/net.d
Dec 13 19:22:24 k8s-master kubelet[25624]: E1213 19:22:24.516216   25624 kubelet.go:2173] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
Dec 13 19:22:28 k8s-master kubelet[25624]: W1213 19:22:28.854066   25624 cni.go:213] Unable to update cni config: No networks found in /etc/cni/net.d
Dec 13 19:22:29 k8s-master kubelet[25624]: E1213 19:22:29.517910   25624 kubelet.go:2173] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
Dec 13 19:22:33 k8s-master kubelet[25624]: W1213 19:22:33.854289   25624 cni.go:213] Unable to update cni config: No networks found in /etc/cni/net.d
Dec 13 19:22:34 k8s-master kubelet[25624]: E1213 19:22:34.526742   25624 kubelet.go:2173] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
Dec 13 19:22:38 k8s-master kubelet[25624]: W1213 19:22:38.855249   25624 cni.go:213] Unable to update cni config: No networks found in /etc/cni/net.d
Dec 13 19:22:39 k8s-master kubelet[25624]: E1213 19:22:39.528488   25624 kubelet.go:2173] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
Dec 13 19:22:43 k8s-master kubelet[25624]: W1213 19:22:43.856071   25624 cni.go:213] Unable to update cni config: No networks found in /etc/cni/net.d
Dec 13 19:22:44 k8s-master kubelet[25624]: E1213 19:22:44.544738   25624 kubelet.go:2173] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
Dec 13 19:22:48 k8s-master kubelet[25624]: W1213 19:22:48.857050   25624 cni.go:213] Unable to update cni config: No networks found in /etc/cni/net.d
Dec 13 19:22:49 k8s-master kubelet[25624]: E1213 19:22:49.546304   25624 kubelet.go:2173] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
Dec 13 19:22:53 k8s-master kubelet[25624]: W1213 19:22:53.858434   25624 cni.go:213] Unable to update cni config: No networks found in /etc/cni/net.d
Dec 13 19:22:54 k8s-master kubelet[25624]: E1213 19:22:54.553591   25624 kubelet.go:2173] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
Dec 13 19:22:58 k8s-master kubelet[25624]: W1213 19:22:58.859184   25624 cni.go:213] Unable to update cni config: No networks found in /etc/cni/net.d
Dec 13 19:22:59 k8s-master kubelet[25624]: E1213 19:22:59.555350   25624 kubelet.go:2173] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
Dec 13 19:23:03 k8s-master kubelet[25624]: W1213 19:23:03.859393   25624 cni.go:213] Unable to update cni config: No networks found in /etc/cni/net.d
Dec 13 19:23:04 k8s-master kubelet[25624]: E1213 19:23:04.560084   25624 kubelet.go:2173] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
Dec 13 19:23:08 k8s-master kubelet[25624]: W1213 19:23:08.860359   25624 cni.go:213] Unable to update cni config: No networks found in /etc/cni/net.d
Dec 13 19:23:09 k8s-master kubelet[25624]: E1213 19:23:09.565823   25624 kubelet.go:2173] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
Dec 13 19:23:13 k8s-master kubelet[25624]: W1213 19:23:13.860526   25624 cni.go:213] Unable to update cni config: No networks found in /etc/cni/net.d
Dec 13 19:23:14 k8s-master kubelet[25624]: E1213 19:23:14.568539   25624 kubelet.go:2173] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
Dec 13 19:23:18 k8s-master kubelet[25624]: W1213 19:23:18.860878   25624 cni.go:213] Unable to update cni config: No networks found in /etc/cni/net.d
Dec 13 19:23:19 k8s-master kubelet[25624]: E1213 19:23:19.570216   25624 kubelet.go:2173] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized


root@xxx:/etc/docker# mkdir -p $HOME/.kube
root@xxx:/etc/docker# cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
root@xxx:/etc/docker# chown $(id -u):$(id -g) $HOME/.kube/config


Command 'ipconfig' not found, did you mean:

  command 'iconfig' from deb ipmiutil
  command 'ifconfig' from deb net-tools
  command 'iwconfig' from deb wireless-tools

Try: apt install <deb name>


root@xxx:/etc/docker# kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/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 created

③获取token

kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $
1}')
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐