2. Unable to generate self signed cert: mkdir /var/run/kubernetes: permission denied
Aug1211:07:05 master kube-apiserver[5336]: E081211:07:05.0638375336 genericapiserver.go:702] Unable to generate self signed cert: mkdir /var/run/kubernetes: permission denied Aug1211:07:05 master kube-apiserver[5336]: I081211:07:05.0639155336 genericapiserver.go:734] Serving insecurely on0.0.0.0:8080 Aug1211:07:05 master systemd[1]: Started Kubernetes API Server. Aug1211:07:05 master kube-apiserver[5336]: E081211:07:05.0641515336 genericapiserver.go:716] Unable to listen for secure (open /var/run/kubernetes/apiserver.crt: no such file or directory); will try again.
解决办法:
# mkdir -p /var/run/kubernetes/ # chown -R kube.kube /var/run/kubernetes/ # for SERVICES in etcd kube-apiserver kube-controller-manager kube-scheduler; do systemctl restart $SERVICES systemctl enable $SERVICES systemctl status $SERVICES done
# docker logs b7cff1accc06 Starting HTTP serveron port 9090 Creating API server client for http://localhost:8080 Error while initializing connectionto Kubernetes apiserver. This most likely means that the clusteris misconfigured (e.g., it has invalid apiserver certificates or service accounts configuration) or the --apiserver-host param points to a server that does not exist. Reason: Get http://localhost:8080/version: dial tcp 202.102.110.203:8080: getsockopt: connection refused
删除原有失败的kubernetes-dashboard
# kubectl delete -f kubernetes-dashboard.yaml
修改 kubernetes-dashboard.yaml 文件加入以下行
# vim kubernetes-dashboard.yaml ports: -containerPort:9090 protocol:TCP args: # Uncomment the following line to manually specify Kubernetes API server Host # If not specified, Dashboard will attempt to auto discover the API server and connect # to it. Uncomment only if the default does not work. # - --apiserver-host=http://my-address:port ---apiserver-host=http://192.168.2.247:8080##加入此行 指定apiserver地址
重新创建kubernetes-dashboard
# kubectl create -f kubernetes-dashboard.yaml
6. 不能浏览器访问kubernetes-dashboard
Error: 'dial tcp 172.17.97.3:9090: i/o timeout' Trying to reach: 'http://172.17.97.3:9090/'
master上安装flannel
# yum install -y flannel
编辑flannel配置文件并启动
# vim /etc/sysconfig/flanneld
# Flanneld configurationoptions
# etcd url location. Point this to the serverwhere etcd runs FLANNEL_ETCD="http://192.168.2.247:2379"
# etcd config key. This is the configuration key that flannel queries # For address range assignment FLANNEL_ETCD_KEY="/coreos.com/network"
# Any additional options that you want to pass #FLANNEL_OPTIONS=""