Difficulty: intermediate
Estimated Time: 20-30 minutes

BoxBoat Logo

Welcome to day 2 of Kubernetes Fundamentals! We spent a lot of time yesterday going over the core objects in Kubernetes, and there are a lot of them. Configuring these objects is relatively easy, but can be extremely verbose, and there are a lot of extra pieces of configuration to consider.

Before we dive into new concepts for day 2, let's go over what we did yesterday.

Please email feedback to: [email protected]

Now that we're refreshed everything from the previous day, let's dive into Services.

KF1 Review

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/tutum.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 tutum

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

kubectl logs tutum-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 tutum-deployment