2. Unable to generate self signed cert: mkdir /var/run/slug:: permission denied
1
2
3
4
Aug 12 11:07:05 master kube-apiserver[5336]: E0812 11:07:05.063837 5336 genericapiserver.go:702] Unable to generate self signed cert: mkdir /var/run/slug:: permission denied
Aug 12 11:07:05 master kube-apiserver[5336]: I0812 11:07:05.063915 5336 genericapiserver.go:734] Serving insecurely on 0.0.0.0:8080
Aug 12 11:07:05 master systemd[1]: Started Kubernetes API Server.
Aug 12 11:07:05 master kube-apiserver[5336]: E0812 11:07:05.064151 5336 genericapiserver.go:716] Unable to listen for secure (open /var/run/slug:/apiserver.crt: no such file or directory); will try again.
解决办法:
1
2
3
4
5
6
7
# mkdir -p /var/run/slug:/
# chown -R kube.kube /var/run/slug:/
# for SERVICES in etcd kube-apiserver kube-controller-manager kube-scheduler; do
systemctl restart $SERVICES
systemctl enable $SERVICES
systemctl status $SERVICES
done
5. Get http://localhost:8080/version: dial tcp 202.102.110.203:8080: getsockopt: connection refused
1
2
3
4
# docker logs b7cff1accc06
Starting HTTP server on port 9090
Creating API server client for http://localhost:8080
Error while initializing connection to Kubernetes apiserver. This most likely means that the cluster is 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
1
# kubectl delete -f slug:-dashboard.yaml
修改 slug:-dashboard.yaml 文件加入以下行
1
2
3
4
5
6
7
8
9
10
# vim slug:-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
1
# kubectl create -f slug:-dashboard.yaml
6. 不能浏览器访问kubernetes-dashboard
1
2
Error: 'dial tcp 172.17.97.3:9090: i/o timeout'
Trying to reach: 'http://172.17.97.3:9090/'
master上安装flannel
1
# yum install -y flannel
编辑flannel配置文件并启动
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# vim /etc/sysconfig/flanneld
# Flanneld configuration options
# etcd url location. Point this to the server where 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=""
# systemctl enable flanneld.service ; systemctl start flanneld.service