安装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



 


 
posted @ 2019-09-21 16:12  C,python,linux,java  阅读(5783)  评论(8编辑  收藏  举报