最近尝试安装 kubernetes 因为墙的问题弄的是焦头烂额, 特记录下
一.Docker的安装
参照官方文档 配置yum源为阿里源 基本安装就没啥问题
二.cri-dockerd 安装
因为国内的网络问题
1.建议采取先单独安装GO 且配置GO的GOPROXY 设置为国内代理。
如下:go env -w GOPROXY=https://goproxy.cn,direct 再参照 https://github.com/Mirantis/cri-dockerd 对源码进行编译和配置。 我根据官方的编译部署后 尝试多次就是启动不了 报systemctl enable cri-docker.service 提示 Unit file cri-docker.service does not exist 的错误 后面先根据 k8s 容器运行时 containerd 的安装先把CNI 安装了,配置 vim /etc/systemd/system/cri-docker.service 配置 ExecStart=/usr/bin/cri-dockerd --network-plugin=cni --pod-infra-container-image=registry.aliyuncs.com/google_containers/pause:3.9 --container-runtime-endpoint fd:// 之后 cri-dockerd就成功运行了三 K8S 安装
cat <<EOF > /etc/yum.repos.d/kubernetes.repo [kubernetes] name=Kubernetes baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/ enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg EOF setenforce 0 yum install -y kubelet kubeadm kubectl systemctl enable kubelet && systemctl start kubelet
2.生成配置文件
kubeadm config print init-defaults > kubeadm.yml Vim kubeadm.yml 修改配置文件 注意标红为修改处apiVersion: kubeadm.k8s.io/v1beta3 bootstrapTokens: - groups: - system:bootstrappers:kubeadm:default-node-token token: abcdef.0123456789abcdef ttl: 24h0m0s usages: - signing - authentication kind: InitConfiguration localAPIEndpoint: advertiseAddress: 192.168.80.165 bindPort: 6443 nodeRegistration: criSocket: unix:///run/cri-dockerd.sock imagePullPolicy: IfNotPresent name: master taints: null --- apiServer: timeoutForControlPlane: 4m0s apiVersion: kubeadm.k8s.io/v1beta3 certificatesDir: /etc/kubernetes/pki clusterName: kubernetes controllerManager: {} dns: {} etcd: local: dataDir: /var/lib/etcd imageRepository: registry.cn-hangzhou.aliyuncs.com/google_containers kind: ClusterConfiguration kubernetesVersion: 1.26.0 controlPlaneEndpoint: "192.168.80.165:6443" networking: dnsDomain: cluster.local serviceSubnet: 10.96.0.0/12 scheduler: {}拉取镜像 kubeadm config images pull --config kubeadm.yml kubeadm init --config kubeadm.yml
标签:kubernetes,--,yum,docker,cri,com,kubeadm From: https://www.cnblogs.com/RunStone/p/17031779.html