Difficulty: intermediate
Estimated Time: 20-30 minutes

Digital Academy Logo

Welcome to the Digital Academy's "Kubernetes Fundamentals" series. This is Module 6 - Review Fundamentals

In this lab, we will quickly review all of the things we have learned so far.

Developer(s): William Hearn and Zachary Seguin

Module 6 - Review Fundamentals

Step 1 of 5

Kubectl

Kubectl is the primary way that we will interact with a Kubernetes cluster. It can be used to both query and modify Kubernetes objects.

For example, we can get information about our cluster's nodes:

kubectl get nodes

Here's information about our cluster:

kubectl cluster-info

We'll usually start by creating an object:

kubectl create -f <file.yaml>

Once an object is created, we can always update it later:

kubectl apply -f <file.yaml>

Let's run a simple hello-world Deployment:

kubectl create -f ./resources/nginx-deployment.yaml

Now that we have a running application, we can examine it with kubectl get:

kubectl get deployments

kubectl get pods

We can even go down a level below, and directly query Docker:

docker container ls -a

We can get more information about a resource with kubectl describe.

kubectl describe deployment nginx-deployment

We can also debug our Deployments by checking logs from individual pods:

kubectl logs nginx-deployment-<deployment-id>-<container-id>

This is similar to performing a docker logs <container name>.

There is also a shorthand for using kubectl get, namely Pods = po, ReplicaSets = rs, Deployments = deploy, Service = svc

When we want to delete a resource, we use kubectl delete:

kubectl delete -f <object.yaml>

kubectl delete pods, deployments -l app=wordpress

kubectl delete pods|deployments|services --all

kubectl delete pods|deployments|services <name>

kubectl delete deployment nginx-deployment

This tab will not be visible to users and provides only information to help authors when creating content.

Creating Katacoda Scenarios

Thanks for creating Katacoda scenarios. This tab is designed to help you as an author have quick access the information you need when creating scenarios.

Here are some useful links to get you started.

Running Katacoda Workshops

If you are planning to use Katacoda for workshops, please contact [email protected] to arrange capacity.

Debugging Scenarios

Below is the response from any background scripts run or files uploaded. This stream can aid debugging scenarios.

If you still need assistance, please contact [email protected]