flannel在docker中安装
flannel结点步骤
1 | 登录192.168.106.117 ,其他结点类似。 |
flannel对应etcd配置
1 | 登录192.168.106.237 |
结点其他配置
1 | [root@managementa ~] iptables -F |
k8s ca证书部署
1 | 下载 cfssl 工具:https://pkg.cfssl.org/ |
k8s DNS安装
1 | k8s集群部署完后第一件事就是要配置DNS服务,目前可选的方案有skydns, kube-dns, coredns |
Dashboard 安装
1 | 安装v1.10.1有很多404错误,找不到heapster服务等错误,heapster已经被metrics server取代,可能是版本问题,安装最新版本。 |
metrics server安装(K8S从1.7版本开始引入metrics server替代heapster)
1 | apiserver开启如下参数 |
Ingress安装
1 | **apiserver配置** |
错误解决
Nov 8 12:49:33 managementa kube-controller-manager: E1108 12:49:33.842331 30295 replica_set.go:450] Sync “ingress-nginx/nginx-ingress-controller-579bdfc57f” failed with pods “nginx-ingress-controller-579bdfc57f-x9v54” is forbidden: SecurityContext.RunAsUser is forbidden
1
2
3
4
5
6
7
8
9
10[root@managementa conf]# cat apiserver
KUBE_API_ARGS="--service-account-key-file=/root/fk/conf/serviceaccount.key --etcd-servers=http://192.168.106.237:2379 --insecure-bind-address=0.0.0.0 --insecure-port=9090 --service-cluster-ip-range=169.169.0.0/16 --service-node-port-range=1-65535 --admission-control=NamespaceLifecycle,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota --logtostderr=false --log-dir=/var/log/kubernetes --v=2"
去掉SecurityContextDeny
[root@managementa conf]# cat apiserver
KUBE_API_ARGS="--service-account-key-file=/root/fk/conf/serviceaccount.key --etcd-servers=http://192.168.106.237:2379 --insecure-bind-address=0.0.0.0 --insecure-port=9090 --service-cluster-ip-range=169.169.0.0/16 --service-node-port-range=1-65535 --admission-control=NamespaceLifecycle,LimitRanger,ServiceAccount,ResourceQuota --logtostderr=false --log-dir=/var/log/kubernetes --v=2"
重启apiserver
[root@managementa conf]# systemctl restart kube-apiserverE1108 05:13:57.600996 6 config.go:428] Expected to load root CA config from /var/run/secrets/kubernetes.io/serviceaccount/ca.crt, but got err: open /var/run/secrets/kubernetes.io/serviceaccount/ca.crt: no such file or directory
这个估计是没有指定api-server参数导致的,他默认使用https
1 | [root@managementa ~]# kubectl get secrets --namespace=kube-system |
ingress服务安装
1 | [root@managementa workdir]# vi ingress-nginx.yaml |
k8s测试环境配置
1 | [root@managementa fk]# ls |
ingress配置dashboard
1 |
|