User Tools

Site Tools


cloud:kubernetes:installation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
cloud:kubernetes:installation [2017/04/04 10:26]
frank
cloud:kubernetes:installation [2017/04/04 13:48] (current)
frank
Line 12: Line 12:
   * On nodes:   * On nodes:
     * kubernetes-client,​ kubernetes-node - 1.5.2-0.2.gitc55cf2b.el7     * kubernetes-client,​ kubernetes-node - 1.5.2-0.2.gitc55cf2b.el7
 +
 +
 +== Hostnames, IP, subnets, IP ranges ==
 +  * master and node IPs
 +    * master: ​ node-1(192.168.50.101/​24,​ IP address is on eth1)
 +    * nodes: node2(192.168.50.102/​24),​ node-3(192.168.50.103/​24),​ IP Address are on eth1
 +  * kubernetes cluster IP range: 10.254.0.0/​16
 +  * flannel: iface on eth1, range: 172.30.0.0/​16,​ subnetLen:​24,​ type: vxlan
 +
 +== Ports ==
 +  * etcd: 2379
 +  * kube-apiserver:​ 8080
 +  * kubelet: 10250
 +  * 
  
 == Services == == Services ==
Line 65: Line 79:
 FLANNEL_ETCD_ENDPOINTS="​http://​node-1:​2379"​ FLANNEL_ETCD_ENDPOINTS="​http://​node-1:​2379"​
 FLANNEL_ETCD_PREFIX="/​kube-centos/​network"​ FLANNEL_ETCD_PREFIX="/​kube-centos/​network"​
 +FLANNEL_OPTIONS="​-iface=eth1"​
 </​code>​ </​code>​
   * manual step to configure flannel with etcd<​code>​   * manual step to configure flannel with etcd<​code>​
Line 77: Line 92:
 /​usr/​bin/​kube-controller-manager --logtostderr=true --v=0 --master=http://​node-1:​8080 /​usr/​bin/​kube-controller-manager --logtostderr=true --v=0 --master=http://​node-1:​8080
 /​usr/​bin/​kube-scheduler --logtostderr=true --v=0 --master=http://​node-1:​8080 /​usr/​bin/​kube-scheduler --logtostderr=true --v=0 --master=http://​node-1:​8080
-/​usr/​bin/​flanneld -etcd-endpoints=http://​node-1:​2379 -etcd-prefix=/​kube-centos/​network+/​usr/​bin/​flanneld -etcd-endpoints=http://​node-1:​2379 -etcd-prefix=/​kube-centos/​network ​-iface=eth1
 </​code>​ </​code>​
   * nodes<​code>​   * nodes<​code>​
 /​usr/​bin/​kubelet --logtostderr=true --v=0 --api-servers=http://​node-1:​8080 --address=0.0.0.0 --port=10250 --hostname-override=node-2 --allow-privileged=false /​usr/​bin/​kubelet --logtostderr=true --v=0 --api-servers=http://​node-1:​8080 --address=0.0.0.0 --port=10250 --hostname-override=node-2 --allow-privileged=false
 /​usr/​bin/​kube-proxy --logtostderr=true --v=0 --master=http://​node-1:​8080 /​usr/​bin/​kube-proxy --logtostderr=true --v=0 --master=http://​node-1:​8080
 +/​usr/​bin/​flanneld -etcd-endpoints=http://​node-1:​2379 -etcd-prefix=/​kube-centos/​network -iface=eth1
 </​code>​ </​code>​
  
-== Hostnames, subnets, IP ranges ​== +== First pod - Hello Kubernetes! ​== 
-  * master and node IPs +<​code>​ 
-    * master:  ​node-1(192.168.50.101/24) +$ kubectl run node-hello --image=gcr.io/google-samples/node-hello:1.0 --port=8080
-    * nodes: node2(192.168.50.102/24), node-3(192.168.50.103/​24) +
-    * kubernetes cluster IP range10.254.0.0/16 +
-    * flannel: 172.30.0.0/​16,​ subnetLen:​24,​ type: vxlan+
  
-== Ports == +$ kubectl get deploy 
-  * etcd: 2379 +NAME         ​DESIRED ​  ​CURRENT ​  UP-TO-DATE ​  ​AVAILABLE ​  AGE 
-  * kube-apiserver: 8080 +node-hello ​  ​1 ​        ​1 ​        ​1 ​           1           1h
-  * kubelet: 10250+
  
 +$ kubectl get po
 +NAME                          READY     ​STATUS ​   RESTARTS ​  AGE
 +node-hello-3526609615-fqf4k ​  ​1/​1 ​      ​Running ​  ​0 ​         1h
  
-== First pod ==+ 
 +$ kubectl expose deploy/​node-hello --type=NodePort 
 +service "​node-hello"​ exposed 
 + 
 +$ kubectl get svc -l run=node-hello 
 +NAME         ​CLUSTER-IP ​    ​EXTERNAL-IP ​  ​PORT(S) ​         AGE 
 +hello-node ​  ​10.254.139.8 ​  <​nodes> ​      ​8080:​30881/​TCP ​  11s 
 + 
 +$ kubectl get po -l run=node-hello -o wide 
 +NAME                          READY     ​STATUS ​   RESTARTS ​  ​AGE ​      ​IP ​          ​NODE 
 +node-hello-3526609615-fqf4k ​  ​1/​1 ​      ​Running ​  ​0 ​         1h        172.30.5.2 ​  ​node-3 
 + 
 +$ curl http://​node-3:​30881 
 +Hello Kubernetes! 
 + 
 +$ curl http://​node-2:​30881 
 +Hello Kubernetes! 
 + 
 + 
 +</​code>​ 
 + 
 +== 2nd pod with replicas ​==
 <​code>​ <​code>​
-$ kubectl run hello-node --image=gcr.io/​google-samples/​node-hello:​1.0 --port=8080 +$ kubectl run kubernetes-bootcamp --image=jocatalin/​kubernetes-bootcamp:​v1 --port=8080 
-$ kubectl run k8s-bootcamp --image=jocatalin/​kubernetes-bootcamp:​v1 --port=8080+deployment "​kubernetes-bootcamp"​ created
  
 +$ kubectl get deploy
 +NAME                  DESIRED ​  ​CURRENT ​  ​UP-TO-DATE ​  ​AVAILABLE ​  AGE
 +kubernetes-bootcamp ​  ​1 ​        ​1 ​        ​1 ​           1           16s
  
-$ kubectl get deployment hello-node 
-NAME         ​DESIRED ​  ​CURRENT ​  ​UP-TO-DATE ​  ​AVAILABLE ​  AGE 
-hello-node ​  ​1 ​        ​1 ​        ​1 ​           1           2d 
  
-$ kubectl get pods +$ kubectl get po 
-NAME                          READY     ​STATUS ​   RESTARTS ​  AGE +NAME                                   ​READY     ​STATUS ​   RESTARTS ​  AGE 
-hello-node-3526609615-5slx8   1/1       ​Running ​  ​0 ​         ​2d+kubernetes-bootcamp-2019480069-jtswf   1/1       ​Running ​  ​0 ​         ​18s
  
-$ kubectl expose ​deployment hello-node --type=NodePort+$ kubectl expose ​deploy/​kubernetes-bootcamp ​--type=NodePort 
 +service "​kubernetes-bootcamp"​ exposed
  
-$ kubectl get service hello-node +$ kubectl get svc 
-NAME         ​CLUSTER-IP ​     EXTERNAL-IP ​  ​PORT(S) ​         AGE +NAME                  CLUSTER-IP ​      ​EXTERNAL-IP ​  ​PORT(S) ​         AGE 
-hello-node   10.254.65.168   <​nodes> ​      8080:32260/TCP   2d+kubernetes ​           10.254.0.1 ​      <​none> ​       443/​TCP ​         1h 
 +kubernetes-bootcamp ​  10.254.195.177   <​nodes> ​      8080:32693/TCP   13s
  
-$ kubectl get pods --selector="​run=hello-node"​ --output=wide +$ kubectl get po -wide 
-NAME                          READY     ​STATUS ​   RESTARTS ​  ​AGE ​      ​IP ​           NODE +NAME                                   ​READY     ​STATUS ​   RESTARTS ​  ​AGE ​      ​IP ​           NODE 
-hello-node-3526609615-5slx8   1/1       ​Running ​  ​0 ​         ​2d        ​172.30.65.2   ​node-2+kubernetes-bootcamp-2019480069-jtswf   1/1       ​Running ​  ​0 ​         ​1m        ​172.30.93.2   ​node-2
  
-$ curl http://​node-2:​32260 +$ curl http://​node-2:​32693 
-Hello Kubernetes!+Hello Kubernetes ​bootcamp| Running on: kubernetes-bootcamp-2019480069-jtswf | v=1 
 +$ curl http://​node-2:​32693 
 +Hello Kubernetes bootcamp! | Running on: kubernetes-bootcamp-2019480069-jtswf | v=1 
 +$ kubectl logs kubernetes-bootcamp-2019480069-jtswf 
 +Kubernetes Bootcamp App Started At: 2017-04-04T19:​45:​42.811Z | Running On:  kubernetes-bootcamp-2019480069-jtswf  
 +Running On: kubernetes-bootcamp-2019480069-jtswf | Total Requests: 1 | App Uptime: 112.899 seconds | Log Time: 2017-04-04T19:​47:​35.710Z 
 +Running On: kubernetes-bootcamp-2019480069-jtswf | Total Requests: 2 | App Uptime: 127.612 seconds | Log Time: 2017-04-04T19:​47:​50.423Z 
 + 
 +$ kubectl scale deploy/​kubernetes-bootcamp --replicas=4 
 +deployment "​kubernetes-bootcamp"​ scaled 
 + 
 +$ kubectl get po -o wide 
 +NAME                                   ​READY ​    ​STATUS ​   RESTARTS ​  ​AGE ​      ​IP ​           NODE 
 +kubernetes-bootcamp-2019480069-220qd ​  ​1/​1 ​      ​Running ​  ​0 ​         57m       ​172.30.5.3 ​   node-3 
 +kubernetes-bootcamp-2019480069-ftzgl ​  ​1/​1 ​      ​Running ​  ​0 ​         57m       ​172.30.5.2 ​   node-3 
 +kubernetes-bootcamp-2019480069-jtswf ​  ​1/​1 ​      ​Running ​  ​0 ​         59m       ​172.30.93.2 ​  ​node-2 
 +kubernetes-bootcamp-2019480069-k0gkq ​  ​1/​1 ​      ​Running ​  ​0 ​         57m       ​172.30.93.3 ​  ​node-2 
 + 
 +$ curl http://​node-2:​32693 
 +Hello Kubernetes bootcamp! | Running on: kubernetes-bootcamp-2019480069-ftzgl | v=1 
 +$ curl http://​node-3:​32693 
 +Hello Kubernetes bootcamp! | Running on: kubernetes-bootcamp-2019480069-220qd | v=1 
 +$ curl http://​node-3:​32693 
 +Hello Kubernetes bootcamp! | Running on: kubernetes-bootcamp-2019480069-k0gkq | v=1 
 +$ curl http://​node-2:​32693 
 +Hello Kubernetes bootcamp! | Running on: kubernetes-bootcamp-2019480069-jtswf | v=1
 </​code>​ </​code>​
cloud/kubernetes/installation.1491326809.txt.gz · Last modified: 2017/04/04 10:26 by frank