...
> sudo systemctl start haproxy
> sudo systemctl enable haproxy
> sudo systemctl status haproxy
...
Notice the addition of the --experimental-control-plane
flag. This flag automates joining this control plane node to the cluster.
As your non root user:
|
Verify that the node has joined the cluster:
From the k8smaster1 under the test account issue the following command:
> kubectl get nodes
...
Setup Worker Nodes
From Perform the following steps on all of the worker nodes (k8sworker1, k8sworker2, k8sworker3).
Set the hostname
> sudo su
> hostnamectl set-hostname k8sworker1
> hostnamectl
> reboot
Join the Cluster
From the worker nodes issue the following worker nodes issue the following command. If your token has expired from you may need to create a new one.
> sudo su
> kubeadm join k8slb.ott.dev.intra:6443 --token ktemf3.pshisb9lspt1i40i --discovery-token-ca-cert-hash sha256:1e737466a59f00083a4ddf43c9fcf446a5b1cee8346afd1565d341fe5dee2c46
...
> kubectl get nodes
Code Block |
---|
Install Dashboard
From the master node:
NAME STATUS ROLES AGE VERSION
k8smaster1 Ready master 27m v1.13.4
k8smaster2 Ready master 8m43s v1.13.4
k8smaster3 Ready master 7m56s v1.13.4
k8sworker1 Ready <none> 71s v1.13.4
k8sworker2 Ready <none> 63s v1.13.4
k8sworker3 Ready <none> 25s v1.13.4 |
Install Dashboard
From the master node:
Code Block |
---|
> kubectl create |
Code Block |
> 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
|
...
Sign in using the token previously retrieved.
Install Sample Pod
> vi nginx-example.yaml
Code Block |
---|
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 kind: Deployment metadata: name: nginx-deployment spec: selector: matchLabels: app: nginx replicas: 23 # tells deployment to run 23 pods matching the template template: template metadata: labels: app: nginx spec: metadata containers: labels- name: nginx appimage: nginx:1.7.9 specports: containers: - containerPort: 80 --- apiVersion: -v1 kind: Service metadata: name: nginx spec: type: NodePort selector: image app: nginx:1.7.9 ports: - port: 80 ports: nodePort: 31080 - containerPortname: 80nginx |
> kubectl apply -f nginx-example.yamlExpose your nginx pods via a nodePort
> kubectl expose deployment nginx-deployment --type=NodePort --name=nginx> kubectl get services
Code Block |
---|
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 95m5h32m nginx NodePort 10.9899.77190.176114 <none> 80:3149031080/TCP 119s2m46s |
From the above we can see that the nginx service is exposed on port 3149031080.
Verify by issuing the following command:
> curl http://<NODE_IP>:31490:31080
Troubleshooting
Reset and start all over
...