opensuse 安装K8S集群四(安装控制节点一containerd)

1.确认前期工作都完成后,提前下载镜像(opensuse不一样)

  kubeadm config images list

2.去阿里云下载对应镜像

   crictl image list = ctr -n=k8s.io image list

3.拉取镜像

ctr -n=k8s.io image pull registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver:v1.20.11 registry.opensuse.org/kubic/kube-apiserver:v1.20.11
ctr -n=k8s.io image pull registry.cn-hangzhou.aliyuncs.com/google_containers/kube-controller-manager:v1.20.11 registry.opensuse.org/kubic/kube-controller-manager:v1.20.11
ctr -n=k8s.io image pull registry.cn-hangzhou.aliyuncs.com/google_containers/kube-scheduler:v1.20.11 registry.opensuse.org/kubic/kube-scheduler:v1.20.11
ctr -n=k8s.io image pull registry.cn-hangzhou.aliyuncs.com/google_containers/kube-proxy:v1.20.11 registry.opensuse.org/kubic/kube-proxy:v1.20.11
ctr -n=k8s.io image pull registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.2 registry.opensuse.org/kubic/pause:3.2
ctr -n=k8s.io image pull registry.cn-hangzhou.aliyuncs.com/google_containers/etcd:3.4.13-0 registry.opensuse.org/kubic/etcd:3.4.13-0
ctr -n=k8s.io image pull registry.cn-hangzhou.aliyuncs.com/google_containers/coredns:1.7.0 registry.opensuse.org/kubic/coredns:1.7.0

4.修改tag

ctr -n=k8s.io image tag registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver:v1.20.11 registry.opensuse.org/kubic/kube-apiserver:v1.20.11
ctr -n=k8s.io image tag registry.cn-hangzhou.aliyuncs.com/google_containers/kube-controller-manager:v1.20.11 registry.opensuse.org/kubic/kube-controller-manager:v1.20.11
ctr -n=k8s.io image tag registry.cn-hangzhou.aliyuncs.com/google_containers/kube-scheduler:v1.20.11 registry.opensuse.org/kubic/kube-scheduler:v1.20.11
ctr -n=k8s.io image tag registry.cn-hangzhou.aliyuncs.com/google_containers/kube-proxy:v1.20.11 registry.opensuse.org/kubic/kube-proxy:v1.20.11
ctr -n=k8s.io image tag registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.2 registry.opensuse.org/kubic/pause:3.2
ctr -n=k8s.io image tag registry.cn-hangzhou.aliyuncs.com/google_containers/etcd:3.4.13-0 registry.opensuse.org/kubic/etcd:3.4.13-0
ctr -n=k8s.io image tag registry.cn-hangzhou.aliyuncs.com/google_containers/coredns:1.7.0 registry.opensuse.org/kubic/coredns:1.7.0

5.由于opensuse的版本老,会出现 k8s initial time out of 40s passed

  mkdir  /etc/systemd/system/kubelet.service.d

   cd /etc/systemd/system/kubelet.service.d

 cat > 10-kubeadm.conf  << EOF 

 # 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  --cgroup-driver=systemd"
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

EOF

systemctl daemon-reload

systemctl restart kubelet

 6.导出安装配置并修改

 kubeadm config print init-defaults > init.default.yaml

kubeadm init --kubernetes-version 1.20.11 --control-plane-endpoint "172.21.31.120:9443" --cri-socket /run//containerd/containerd.sock

由于版本问题或者opensuse故障,无法找到具体原因,kubelet无法找到节点,安装无法继续,后续如果opensuse更新后,再继续测试,现在只能使用docker作为基本运行时。

posted @ 2021-10-18 11:28  魅力无法挡  阅读(277)  评论(0)    收藏  举报