In the following lab we will set up our local development environment, provision the workshop cluster and roll out a static nginx page as single container Pod. Your deployment won't be exposed and is only available by ClusterIP of the corresponding pod-service. You can access the application by tunneling your localhost through kubectl proxy
command.
- Run deployment
kubectl apply -f .
- You can check the state of Pods at any time with the following kubectl command:
kubectl get pods -n doit-lab-01
- You can also permanently display the current log stream of the pod in question in your terminal using the following command:
kubectl get pods -n doit-lab-01 --watch
- You can access this pod from your local environment by kubectl port-forwarding & access this web-app @localhost:8080
kubectl port-forward pod/static-web-app 8080:80 -n doit-lab-01
- You can also jump directly into a sh-terminal of the started pod
kubectl exec -it static-web-app -n doit-lab-01 -- sh
Now we can set the current k8s context to our lab exercise namespace doit-lab-01
to make sure that every command set is run against this lab resources.
kubectl config set-context --current --namespace=doit-lab-01
kubectl delete -f .