In this lab, you will create and interrogate resources in namespaces and view their DNS names.
The Authentication token stored in your local KUBECONFIG file expires every 10 hours. You will want to re-authenticate to the TKG Service before starting the lab to ensure you have access to the Supervisor cluster.
Run:
kubectl vsphere login --server=[vSphere Control Plane Endpoint] --tanzu-kubernetes-cluster-namespace=poc --tanzu-kubernetes-cluster-name=alphacluster
After successful authentication, change your Kubernetes context to the alphacluster by running:
kubectl config use-context alphacluster
Note: See the Authenticate lab for more a more detailed refresher on the procedures.
Either use the imperative command:
kubectl create namespace tigerteam
or
apply the yaml file
apiVersion: v1
kind: Namespace
metadata:
name: tigerteam
Verify that the namespace was created successfully by running:
kubectl get ns
Use the YAML file found here to deploy nginx pods and a service.
kubectl apply -f nginx-tigerteam.yaml
Verify that the pods and services were deployed correctly.
kubectl get pods -n tigerteam
kubectl get svc -n tigerteam
From within the default namespace deploy a busybox pod and exec into the pod to a shell.
kubectl run curlpod -it --image=curlimages/curl -- sh
Once you have a shell terminal see if you can resolve the app1 service.
nslookup app1.tigerteam.svc.cluster.local
See what happens when you run nslookup without specifying the namespace.
nslookup app1
Now see if you can curl the nginx service in the tigerteam namespace.
kubectl run curlpod -it --image=curlimages/curl -- sh
Exit the utility pod shell by typing:
exit
Delete the tigerteam pods and services.
kubectl delete -f nginx-tigerteam.yaml
Delete the tigerteam namespace
kubectl delete ns tigerteam
Delete the utility pod
kubectl delete pod utility
Kubernetes clusters run many of the control plane components as containers. They may be hiding in one of the other namespaces. Can you find:
- The Kubernetes API Server
- The DNS Server