Run the following on student-node
Ensure all calico pods are running. They can take a while to initialise
watch kubectl get pods -n calico-system
Press CTRL-C
to exit watch when pods are stable
All 5 nodes should now be ready:
kubectl get nodes
Deploy and expose an nginx pod
kubectl create deployment nginx --image nginx:alpine
kubectl expose deploy nginx --type=NodePort --port 80
PORT_NUMBER=$(kubectl get service -l app=nginx -o jsonpath="{.items[0].spec.ports[0].nodePort}")
echo -e "\n\nService exposed on NodePort $PORT_NUMBER"
Hit the new service
curl http://node01:$PORT_NUMBER
curl http://node02:$PORT_NUMBER
Both should return the nginx welcome message as HTML text.
Congratulations! You now have a working HA kubeadm cluster.
node01
or node02
. If you did not note these down, you can find the IP addresses from the EC2 console by looking in the Public IPv4 ...
column (scroll right if this column is not in view).Form a URL using the IP address (it will be different for you) and the NodePort number output from step 1 above, e.g.
http://54.167.161.210:32182