我是Kubeletes的新手,我不能成功地运行“Kubeadm init”。
让我一步一步地告诉你我是怎么做的:
1.我按照Dockers文档使用yum安装了最新版本的Dockers(我已经在/etc/systemd/system/docker.service.d/http-proxy.conf中配置了“环境=“HTTP_PROXY =”“HTTPS_PROXY="”)。
1.我已经禁用了SELINUXTYPE,使用命令“swapoff -a”禁用了交换,并在/etc/fstab中注解了“#/dev/mapper/centos-swap交换默认值0 0”。
1.我使用了“modprobe br_netfilter”和“echo '1'〉/proc/sys/net/bridge/bridge-nf-call-iptables”来激活名为“br_netfilter”的模块。
1.“kubernetes.repo”文件以使用yum安装“kubelet kubeadm kubectl”:
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
1.打开的端口:
firewall-cmd --permanent --add-port=6443/tcp
firewall-cmd --permanent --add-port=2379-2380/tcp
firewall-cmd --permanent --add-port=10250/tcp
firewall-cmd --permanent --add-port=10251/tcp
firewall-cmd --permanent --add-port=10252/tcp
firewall-cmd --permanent --add-port=10255/tcp
firewall-cmd --reload
1.我创建了“10-kubeadm.conf”文件:
[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/sysconfig/kubelet
ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS
1.重新加载并启用服务:
systemctl daemon-reload
systemctl restart docker
systemctl enable docker
systemctl restart kubelet
systemctl enable kubelet
(both具有以下状态的服务:活动(运行))
错误:
[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.
Unfortunately, an error has occurred:
timed out waiting for the condition
This error is likely caused by:
- The kubelet is not running
- The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled)
If you are on a systemd-powered system, you can try to troubleshoot the error with the following commands:
- 'systemctl status kubelet'
- 'journalctl -xeu kubelet'
Additionally, a control plane component may have crashed or exited when started by the container runtime.
To troubleshoot, list all containers using your preferred container runtimes CLI, e.g. docker.
Here is one example how you may list all Kubernetes containers running in docker:
- 'docker ps -a | grep kube | grep -v pause'
Once you have found the failing container, you can inspect its logs with:
- 'docker logs CONTAINERID'
error execution phase wait-control-plane: couldn't initialize a Kubernetes cluster
先谢谢你的帮助。
此致。
2条答案
按热度按时间41ik7eoe1#
请禁用交换
在安装此软件包后注解交换行
并通过此添加repo
您应该使用以下命令安装Docker
然后重新启动
请勿更改10.244.0.0/16
接下来,使用kubectl命令将flannel网络部署到kubernetes集群。
我编写了运行kubernetes的完整方法,并使用此命令运行kubernetes cluster 1000次
xytpbqjk2#
kubeadm初始化仍出错
当我使用命令kubeadm init时--apiserver-advertisement-address=10.244.10.1 --pod-network-cidr= 10.244.0.0/16
[错误CRI]:容器运行时未运行:输出:E1217 02:24:15.210891 12682 remote_runtime.go:948]“运行时服务的状态失败”err=“rpc错误:代码=