安裝k8s出現問題匯總


首先介紹我的環境信息
系統是centos7.6 內核是5.3.0-1.el7.elrepo.x86_64 kubernetes版本是1.16 docker是19.03
問題1
Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker
這個是剛剛完成安裝之后.查看所有K8S運行的組件是否正常,發現kube-dns一直是pending狀態,通過查看日志journalctl -f -u kubelet 發現以上提示,查找
發現是flannel沒有安裝 使用 kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml 命令
安裝最新版的flannel,緊接着就發現問題2

問題2
plugin flannel does not support config version
解決方法:
在/etc/cni/net.d/10-flannel.conflist 里面添加 "cniVersion": "0.2.0"
例如

 

 
        

問題得到解決.

      問題3. 安裝helm 2.14.3 出現錯誤 

  這個主要是兼容性問題 helm2.14.3支持 k8s的1.15和之前的版本,對最新的1.16是支持不是很好,出新版本之后應該就解決了

           

  $ helm init --service-account tiller
  $HELM_HOME has been configured at /Users/xxxx/.helm.
  Error: error installing: the server could not find the requested resourc

解決方法:
helm init --output yaml > tiller.yaml
使用命令:
helm init --service-account tiller --override spec.selector.matchLabels.'name'='tiller',spec.selector.matchLabels.'app'='helm' --output yaml | sed 's@apiVersion: extensions/v1beta1@apiVersion: apps/v1@' | kubectl apply -f -

 

     問題4. kubernetes-dashboard 安裝錯誤

        cannot list resource "****" in API group "****" at the cluster scope  錯誤於此類似.屬於權限錯誤  

        解決方法 :https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/ 按照官網的去安裝 

        第一步 :

 kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta4/aio/deploy/recommended.yaml 

 

       第二步:創建用戶

         dashboard-adminuser.yaml     

apiVersion: v1 kind: ServiceAccount metadata: name: admin-user namespace: kubernetes-dashboard

然后kubectl apply -f dashboard-adminuser.yaml
第三步:加入權限dashboard-adminuser1.yaml

 

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: admin-user
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: admin-user
  namespace: kubernetes-dashboard

第四步:
 kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk '{print $1}')    



問題4 .helm 安裝遇到錯誤
Error: configmaps is forbidden: User "system:serviceaccount:kube-system:default" cannot list resource "configmaps" in API group "" in the namespace "kube-system"

   解決方法:

        kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default



 

 
        
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM