Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

> mkdir -p $HOME/.kube
> sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
> sudo chown $(id -u):$(id -g) $HOME/.kube/config

Install Flannel Network Plugin

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

Verify that all of your kubernetes pods are running

> kubectl get pods --all-namespaces




Verify that your network is on the right network interface

Code Block
kubectl get pods -o wide --all-namespaces

Code Block
NAMESPACE     NAME                               READY   STATUS    RESTARTS   AGE
kube-system    coredns-86c58d9df4-8zk5tIP          NODE 1/1     Running NOMINATED NODE 0          47hREADINESS GATES
kube-system   coredns-86c58d9df4-tsftk8zk5t           10/1     RunningPending   0          2d3h 47h
kube-system  <none> etcd-k8master     <none>     <none>            1/1<none>
kube-system   coredns-86c58d9df4-tsftk   Running   1     0/1     47h
kube-systemPending   0     kube-apiserver-k8master     2d3h   <none>    1/1  <none>   Running  <none> 1          47h<none>
kube-system   kube-controller-manageretcd-k8master   1/1     Running   1          47h
kube-system   kube-flannel-ds-amd64-fl5wp  1/1     Running   1/1     Running   0  2d3h   10.0.3.15   k8master   <none>           12s<none>
kube-system   kube-proxy-88gdq       apiserver-k8master            1/1     Running   1          47h
kube-system2d3h   kube-scheduler-k8master10.0.3.15   k8master   <none>      1/1     Running<none>
kube-system   kube-controller-manager-k8master   1/1     Running   1          2d3h   47h

Join Worker Nodes

User kubeadm join to join the cluster.

> kubeadm join 192.168.56.100:6443 --token 69sqqp.yelc6ct7o3v3uoqp --discovery-token-ca-cert-hash sha256:03b55f52661338d761e8dd68203b738f3e126428cda239db81c2723a7bccba83

Verify it is all working

From the master node:

Code Block
sudo kubectl get nodes

NAME10.0.3.15   k8master   <none>           <none>
kube-system  STATUS kube-proxy-88gdq  ROLES    AGE     VERSION
k8master    Ready    master1/1   47h  Running   v1.13.1
k8worker1   Ready    <none>   12m2d3h     v1.13.1
k8worker210.0.3.15   Ready k8master   <none>   6m12s   v1.13.1


kubectl get pods --all-namespaces

NAMESPACE   <none>
kube-system  NAME kube-scheduler-k8master            1/1     Running   1          READY2d3h   STATUS10.0.3.15   k8master RESTARTS   AGE
kube-system <none>  coredns-86c58d9df4-8zk5t         <none>


The Ip should not be 10.0.3.xxx




Install Flannel Network Plugin

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml


Verify that all of your kubernetes pods are running

> kubectl get pods --all-namespaces

Code Block
NAMESPACE  1/1     Running   2          47h
kube-system   coredns-86c58d9df4-tsftk     NAME      1/1           Running   2          47h
kube-system READY  etcd-k8master STATUS    RESTARTS   AGE
kube-system   coredns-86c58d9df4-8zk5t           1/1     Running   30          47h
kube-system   kubecoredns-apiserver86c58d9df4-k8master tsftk           1/1     Running   30          47h
kube-system   kube-controller-manageretcd-k8master    1/1     Running   3          47h
kube-system1/1   kube-flannel-ds-amd64-fl5wp  Running   1          47h
kube-system   kube-apiserver-k8master            1/1     Running   31          25m47h
kube-system   kube-flannelcontroller-ds-amd64-k26xv     manager-k8master   1/1     Running   01          5m4s47h
kube-system   kube-flannel-ds-amd64-ncg64fl5wp        1/1     Running   10          11m12s
kube-system   kube-proxy-88gdq                   1/1     Running   31          47h
kube-system   kube-proxy-b6m4d       scheduler-k8master            1/1     Running   01          47h



...

Join Worker Nodes

User kubeadm join to join the cluster.

> kubeadm join 192.168.56.100:6443 --token 69sqqp.yelc6ct7o3v3uoqp --discovery-token-ca-cert-hash sha256:03b55f52661338d761e8dd68203b738f3e126428cda239db81c2723a7bccba83


...


Verify it is all working

From the master node:

Code Block
sudo kubectl get nodes

NAME        STATUS   ROLES5m4s
kube-system   kube-proxy-nxwmh         AGE     VERSION
k8master    Ready 1/1   master  Running 47h  1   v1.13.1
k8worker1   Ready    11m
kube-system   kube-scheduler-k8master            1/1     Running   3          47h  <none>   12m     v1.13.1
k8worker2   Ready    <none>   6m12s   v1.13.1


kubectl get pods --all-namespaces

NAMESPACE     NAME                               READY   STATUS    RESTARTS   AGE
kube-system   coredns-86c58d9df4-8zk5t           1/1     Running   2          47h
kube-system   coredns-86c58d9df4-tsftk           1/1     Running   2          47h
kube-system   etcd-k8master                      1/1     Running   3          47h
kube-system   kube-apiserver-k8master            1/1     Running   3          47h
kube-system   kube-controller-manager-k8master   1/1     Running   3          47h
kube-system   kube-flannel-ds-amd64-fl5wp        1/1     Running   3          25m
kube-system   kube-flannel-ds-amd64-k26xv        1/1     Running   0          5m4s
kube-system   kube-flannel-ds-amd64-ncg64        1/1     Running   1          11m
kube-system   kube-proxy-88gdq                   1/1     Running   3          47h
kube-system   kube-proxy-b6m4d                   1/1     Running   0          5m4s
kube-system   kube-proxy-nxwmh                   1/1     Running   1          11m
kube-system   kube-scheduler-k8master            1/1     Running   3          47h

Now deploy something and verify it all works.


Install Some Example Pods

Code Block
> kubectl create -f https://kubernetes.io/examples/application/deployment.yaml
> kubectl get pods

NAME                                READY   STATUS    RESTARTS   AGE
nginx-deployment-76bf4969df-hkmjp   1/1     Running   0          2m18s
nginx-deployment-76bf4969df-x7f9h   1/1     Running   0          2m18s






Install Dashboard

From the master node:

Code Block
> sudo su


> kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/master/aio/deploy/recommended/kubernetes-dashboard.yaml


secret/kubernetes-dashboard-certs created
serviceaccount/kubernetes-dashboard created
role.rbac.authorization.k8s.io/kubernetes-dashboard-minimal created
rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard-minimal created
deployment.apps/kubernetes-dashboard created
service/kubernetes-dashboard created


> kubectl proxy


From your local machine:

> ssh -L 8001:127.0.0.1:8001 test@192.168.56.100


Browse to:

...Now deploy something and verify it all works.


References