kubectl is the primary interface most people use in order to work with Kubernetes. This lab will give you a chance to test and hone your kubectl skills with a real Kubernetes cluster. You will have the opportunity to collect information and make changes to the cluster, all using kubectl.
You are working for BeeBox, a company that provides regular shipments of bees to customers. The company is in the process of building a Kubernetes-based infrastructure for some of their software.
You have several work tickets that will need to be addressed by using kubectl
to interact with the Kubernetes cluster. You will need to collect some information from the cluster and save that information in some files for later review. You will also need to make some changes to the cluster.
Log in to the provided lab server using the credentials provided:
ssh cloud_user@<PUBLIC_IP_ADDRESS>
-
Get a list of persistent volumes sorted by capacity:
kubectl get pv
kubectl get pv -o yaml
kubectl get pv --sort-by=.spec.capacity.storage
-
Save the list to a file:
kubectl get pv --sort-by=.spec.capacity.storage > /home/cloud_user/pv_list.txt
-
List the contents of the file to verify it saved:
cat pv_list.txt
-
Get the contents of a file from inside the
quark
pod's container:kubectl exec quark -n beebox-mobile -- cat /etc/key/key.txt
-
Save it to a file:
kubectl exec quark -n beebox-mobile -- cat /etc/key/key.txt > /home/cloud_user/key.txt
-
List the contents of the file to verify it saved:
cat key.txt
-
Create a deployment using the deployment spec found in
/home/cloud_user/deployment.yml
:kubectl apply -f /home/cloud_user/deployment.yml
kubectl get deployments -n beebox-mobile
kubectl get pods -n beebox-mobile
-
Delete
beebox-auth-svc
:kubectl delete service beebox-auth-svc -n beebox-mobile