K8S部署指导书( 三 )


MINLION
[root@localhost kubernetes]# ifconfig docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1472 inet 172.17.30.1 netmask 255.255.255.0 broadcast 0.0.0.0 inet6 fe80::42:dbff:fe9a:b8bd prefixlen 64 scopeid 0x20<link> ether 02:42:db:9a:b8:bd txqueuelen 0 (Ethernet) RX packets 4164 bytes 1655177 (1.5 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 4392 bytes 467421 (456.4 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 10.10.10.14 netmask 255.255.255.0 broadcast 10.10.10.255 inet6 fe80::a4d2:c607:2321:4812 prefixlen 64 scopeid 0x20<link> inet6 fe80::5236:328f:e632:35f3 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:cb:19:44 txqueuelen 1000 (Ethernet) RX packets 654860 bytes 589926691 (562.5 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 283773 bytes 23145156 (22.0 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 flannel0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1472 inet 172.17.30.0 netmask 255.255.0.0 destination 172.17.30.0 inet6 fe80::5c5a:2bef:c481:fb02 prefixlen 64 scopeid 0x20<link> unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 500 (UNSPEC) RX packets 558 bytes 50560 (49.3 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 789 bytes 928178 (906.4 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
6)测试户ping一下flannel0: 接口的IP是不是能通 能通则正常,如果不通MASTER和minion节点分别指向下面命令
MASTER
service etcd restart;service flanneld restart;service docker restart;iptables -P FORWARD ACCEPT
minion
service etcd restart;service flanneld restart;service docker restart;iptables -P FORWARD ACCEPT
--------------------------------------------------------------------------------------------------------------------------
四、安装web 组件
以下在minion节点操作
如下为配置kubernetes dashboard完整过程,提前导入两个列表镜像
pod-infrastructure
kubernetes-dashboard-amd64
Docker镜像导入指令如下:
n docker load <pod-infrastructure.tgz,将导入的pod镜像名称修改,命令如下:
docker tag $(docker images|grep none|awk '{print $3}') registry.access.redhat.com/rhel7/pod-infrastructure
docker load <kubernetes-dashboard-amd64.tgz,将导入的pod镜像名称修改,命令如下:
docker tag $(docker images|grep none|awk '{print $3}') bestwu/kubernetes-dashboard-amd64:v1.6.3
---------------------------------------------------------
以下操作全部在MASTER完成
在Master端,创建dashboard-controller.yaml,代码如下:
[root@localhost k8s]# more dashboard-controller.yaml apiVersion: extensions/v1beta1 kind: Deployment metadata: name: kubernetes-dashboard namespace: kube-system labels: k8s-App: kubernetes-dashboard kubernetes.io/cluster-service: "true" spec: selector: matchLabels: k8s-app: kubernetes-dashboard template: metadata: labels: k8s-app: kubernetes-dashboard annotations: scheduler.alpha.kubernetes.io/critical-pod: '' scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]' spec: containers: - name: kubernetes-dashboard image: bestwu/kubernetes-dashboard-amd64:v1.6.3 resources: # keep request = limit to keep this container in guaranteed class limits: cpu: 100m memory: 50Mi requests: cpu: 100m memory: 50Mi ports: - containerPort: 9090 args: - --apiserver-host=http://10.10.10.12:8080 livenessProbe: httpGet: path: / port: 9090 initialDelaySeconds: 30 timeoutSeconds: 30
创建dashboard-service.yaml,代码如下:
[root@localhost k8s]# more dashboard-service.yaml apiVersion: v1 kind: Service metadata: name: kubernetes-dashboard namespace: kube-system labels: k8s-app: kubernetes-dashboard kubernetes.io/cluster-service: "true" spec: selector: k8s-app: kubernetes-dashboard ports: - port: 80 targetPort: 9090
创建dashboard dashborad pods模块:
kubectl create -f dashboard-controller.yaml kubectl create -f dashboard-service.yaml
创建完成后,查看Pods和Service的详细信息:,最后一条可以不执行
kubectl get namespace kubectl get deployment --all-namespaces kubectl get svc --all-namespaces kubectl get pods --all-namespaces kubectl get pod -o wide --all-namespaces kubectl describe service/kubernetes-dashboard --namespace="kube-system" kubectl describe pod/kubernetes-dashboard-530803917-816df --namespace="kube-system" kubectl delete pod/kubernetes-dashboard-530803917-816df --namespace="kube-system" --grace-period=0 --force
7)测试
http://10.10.10.12:8080/ui

【K8S部署指导书】


推荐阅读