按照步骤创建单个主集群,我能够成功初始化主集群,但是在应用时出现禁止错误,有人遇到过同样的情况吗?谢谢!
我做了以下
1. disable selinux in /etc/selinux/config, and reboot
2. comment out KUBELET_NETWORK_ARGS in
/etc/systemd/system/kubelet.service.d/10-kubeadm.conf
3. export no_proxy=$no_proxy,<master-ip>
4. export KUBECONFIG=/etc/kubernetes/kubelet.conf in .bash_profile
Run Code Online (Sandbox Code Playgroud)
初始化成功后,尝试申请时
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/v0.10.0/Documentation/kube-flannel.yml
Run Code Online (Sandbox Code Playgroud)
我收到以下错误消息
Error from server (Forbidden): error when retrieving current configuration of:
&{0xc42048ab40 0xc421a83730
flannel https://raw.githubusercontent.com/coreos/flannel/v0.10.0/Documentation/kube-flannel.yml 0xc42109cc20 false}
from server for: "https://raw.githubusercontent.com/coreos/flannel/v0.10.0/Documentation/kube-flannel.yml":
clusterroles.rbac.authorization.k8s.io "flannel" is forbidden:
User "system:node:<master-server-name>"
cannot get clusterroles.rbac.authorization.k8s.io at the cluster scope
Run Code Online (Sandbox Code Playgroud)
一旦您的集群尚未完全发挥作用,将其拆除并从头开始重新创建会更容易:
\n\n$> sudo su\n#> kubeadm reset\n#> rm -rf $HOME/.kube /etc/kubernetes\nRun Code Online (Sandbox Code Playgroud)\n\n#> swapoff -a\n## Don't forget to comment swap partition line in /etc/fstab\n\n## I assume that you have these packages already installed: docker, kubeadm, kubectl\n\n## tune sysctl to pass bridged IPv4 traffic to iptables\xe2\x80\x99 chains. \n## This is a requirement for some CNI plugins to work, for more information please see\n## https://kubernetes.io/docs/concepts/cluster-administration/network-plugins/#network-plugin-requirements\n\n#> cat <<EOF >>/etc/ufw/sysctl.conf\nnet/bridge/bridge-nf-call-ip6tables = 1\nnet/bridge/bridge-nf-call-iptables = 1\nnet/bridge/bridge-nf-call-arptables = 1\nEOF\n#> sudo sysctl --system\nRun Code Online (Sandbox Code Playgroud)\n\n## Do not try to set less than /16 subnet for `--pod-network-cidr`\n\n#> kubeadm init --pod-network-cidr=10.244.0.0/16\n\n## Prepare the kubectl config\n\n#> mkdir -p $HOME/.kube\n#> cp -i /etc/kubernetes/admin.conf $HOME/.kube/config\n#> chown $(id -u):$(id -g) $HOME/.kube/config\nRun Code Online (Sandbox Code Playgroud)\n\n#> kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/v0.10.0/Documentation/kube-flannel.yml\nRun Code Online (Sandbox Code Playgroud)\n\n(以防万一您没有任何工作节点。)
\n\n#> kubectl taint nodes --all node-role.kubernetes.io/master-\nRun Code Online (Sandbox Code Playgroud)\n\n#> kubectl get nodes\n#> kubectl get pods --all-namespaces\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
6601 次 |
| 最近记录: |