假如kubernetes不支持docker了该怎么办
假如kubernetes不支持docker了该怎么办
从官网安装文档可以看到kubernetes支持一下几种:
https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/
如何使用containerd 代替docker呢
https://kubernetes.io/docs/setup/production-environment/container-runtimes/#containerd
containerd安装
一般安装docker会默认安装containerd 此时不启动docker即可
cat > /etc/modules-load.d/containerd.conf <<EOF overlay br_netfilter EOF modprobe overlay modprobe br_netfilter # Setup required sysctl params, these persist across reboots. cat > /etc/sysctl.d/99-kubernetes-cri.conf <<EOF net.bridge.bridge-nf-call-iptables = 1 net.ipv4.ip_forward = 1 net.bridge.bridge-nf-call-ip6tables = 1 EOF sysctl --system # Configure containerd mkdir -p /etc/containerd containerd config default > /etc/containerd/config.toml # Restart containerd systemctl restart containerd && systemctl enable containerd # config kubelet cgroup cat > /etc/default/kubelet <<EOF KUBELET_EXTRA_ARGS=--cgroup-driver=systemd EOF # config CRI cat > /etc/crictl.yaml <<EOF runtime-endpoint: unix:///run/containerd/containerd.sock image-endpoint: unix:///run/containerd/containerd.sock timeout: 10 debug: false EOF
修改/etc/containerd/config.toml文件 镜像地址
sandbox_image = "registry.aliyuncs.com/google_containers/pause:3.2"
使用配置文件方案初始化集群
kubeadm config print init-defaults > kubeadm-config.yaml
修改 kubeadm-config.yaml
apiVersion: kubeadm.k8s.io/v1beta2 bootstrapTokens: - groups: - system:bootstrappers:kubeadm:default-node-token token: abcdef.0123456789abcdef ttl: 24h0m0s usages: - signing - authentication kind: InitConfiguration localAPIEndpoint: advertiseAddress: 192.168.100.80 bindPort: 6443 nodeRegistration: criSocket: /run/containerd/containerd.sock name: k8s-master taints: - effect: NoSchedule key: node-role.kubernetes.io/master --- apiServer: timeoutForControlPlane: 4m0s apiVersion: kubeadm.k8s.io/v1beta2 certificatesDir: /etc/kubernetes/pki clusterName: kubernetes controllerManager: {} dns: type: CoreDNS etcd: local: dataDir: /var/lib/etcd imageRepository: registry.aliyuncs.com/google_containers kind: ClusterConfiguration kubernetesVersion: v1.20.0 networking: podSubnet: 10.244.0.0/16 dnsDomain: cluster.local serviceSubnet: 10.96.0.0/12 scheduler: {}
初始化:
kubeadm init --config kubeadm-config.yaml
安装kube-router代替kube-proxy参考如下文章
https://www.cnblogs.com/xuliang666/p/14380882.html