Let's start with some basic commands to see if kubectl is installed correctly and your setup is working so you can connecto to the Kubernetes cluster
- Print the version of your
kubectlinstallation - Print all nodes of the Kubernetes cluster
- Print all Pods/Deployments/Services available in the default namespace
Everything can also be done with kube-prompt or click if you prefer that over the normal kubectl CLI.
If you're able to interact with the Kubernetes cluster you can continue with the following tasks:
- Adapt the Busybox Pod file in
manifets/kubectl-101/busybox.yamlto get a unique name for your Pod and deploy the Pod to the Kubernetes cluster - Use
kubectl execto get an interactivbashsession in the Kubernetes Pod - Check which services are available in the cluster and try to interfact with one of them (Hint: Prometheus might be a good idea as it has a web UI running on port 9090 and the
busyboximage includeswget)
To get started with Kubernetes deployments we want to port the previous exercise to deploy a Redis server and the Redis-Commander web UI with Docker-Compose to a Kubernetes based deployment.
The Docker-Compose file can be found at manifests/k8s-resources-101/redis-cmder-compose.yaml.
- Start with the given
01-deployment.yamlto create a deployment of a single Redis server and a Redis-Commander in every pod - Validate with
kubectl get podsthat your deployment is running correctly - Connect to your Pod by using
kubectl port-forwardand try to access the web UI to create some keys in the Redis instance - Update the tiven
02-service.yamlto create a Service in Front of your Redis server. - Validate if your service is finding at least one Pod to redirect its traffic to
- Create an Ingress resource with the subdomain
*.mis.inf.fh-rosenheim.de(e.g.sINFmamust-redis-cmder.mis.inf.fh-rosenheim.de) and create an corresponding entry in yourhostsfile as there's unfortunately no DNS resolving the domain correctly. (the last step is already advanced stuff, talk to your lecturer before you start with this task!)