##NetApp User Group (NUG) Kuberenetes Event
This is a simple runthrough where we will be setting up a Kubernetes cluster, deploying a simple web app to test and scale.
- Sign up a new account at GCP, AWS or Azure. Free credits are everywhere!
- Sign up at https://cloud.netapp.com
-
If you chose GCP or Azure, you have Cloud Shell with kubectl installed. Good choice.
-
If you chose AWS, fire up an Ubuntu instance & install kubectl.
sudo snap install kubectl --classic
-
Test your install.
kubectl version
- Go to https://cloud.netapp.com, sign in and click on NetApp Kubernetes Service Start Free Trial.
- Select + New Cluster.
- Choose your cloud and follow authentication instructions. GCP & AWS are easiest.
- GCP: https://stackpointcloud.com/community/tutorial/google-compute-engine-setup-and-authentication
- AWS: https://stackpointcloud.com/community/tutorial/how-to-create-auth-credentials-on-amazon-web-services-aws
- Azure: https://stackpointcloud.com/community/tutorial/how-to-create-auth-credentials-on-azure
- Wait for cluster to show successful install.
- Click into your cluster, and scroll down to + Service.
- Select HAproxy and click install.
-
Set variables & context.
export KUBECONFIG=/path/to/kubeconfig kubectl config use-context stackpoint
-
Test the connection to your cluster.
kubectl get nodes
-
Let’s deploy whoami from GitHub, https://hub.docker.com/r/emilevauge/whoami/
kubectl run whoami --image=emilevauge/whoami
-
Scale the deployment to four replicas.
kubectl scale deployment/whoami --replicas=4
-
Allow port 80 traffic.
kubectl expose deployment/whoami --port=80 --target-port=80 --type=NodePort
-
Grab the whoami-ingress.yaml file & create ingress rules.
kubectl create -f whoami-ingress.yaml
-
Check ingress routes for whoami.
kubectl get ingress/whoami
-
Hit the web service via the HA Proxy load balancer IP.
curl -s http://xx.xx.xx.xx
-
Grab the whoami-hammer.sh script file.
-
Modify the script to point at your HA Proxy IP.
-
Run the script - it will poll the service 10 times by default.
sh whoami-hammer.sh
-
See the distribution of hits across the four workers.
-
Adjust the number of replicas & rerun the hammer script.
kubectl scale deployment/whoami --replicas=8 sh whoami-hammer.sh
- You now have a fully functional Kubernetes cluster running with a sample app.
- Explore some of the other services like Prometheus for logging.
Don't forget to remove your cluster when you're done!
Special thanks to @DazWilkin for this idea via his medium.com article.