Noob on the Kube?(rnetes)

Dane Forslund
3 min readJul 30, 2022

--

Exploring Kubernetes in an exponential way…

Kubernetes (or K8’s) is quickly becoming a favorite among the open-source platforms for orchestrating and managing containerized workloads and services.

Kubernetes provides:

  • Service discovery and load balancing
  • Storage Orchestration
  • Automated Rollouts and Rollbacks
  • Automated bin packing
  • Self healing
  • Secret and Configuration management

One of the services that Kubernetes provides is the ability to deploy Pods with identical ReplicaSet’s. This just means that we can create a given number of groups of containers that operate under the same circumstances with the same results.

We will demonstrate what this looks like, by creating a deployment with an Nginx image, while using a YAML file to set the parameters. We will display our deployment info, then modify our ReplicaSet and display the info again. This will show how the ReplicaSet works, and lastly we will delete our deployed containers.

Before we move on…

You should have an account with Docker, Docker Hub, and have the desktop app installed. Next, have your Docker Desktop open and have your Kubernetes settings enabled.

First, lets take a peek at a basic deployment.yml file. I have written some #notes on what some of the code represents.

We will be using this file to deploy our Pods and ReplicaSets. Open up your command line and type:

vim deploy.yml

Copy and paste the code up above, then save and quit.

Next, type:

kubectl apply -f deploy.yml

This will have taken the code from the yaml file, and deployed your pods!

Lets check with:

kubectl get deployments

Perfect! Notice the ”1/1". This is the total number of running pods, out of the total we created. Lets end this deployment, modify our ReplicaSet to 4, and see the change.

To delete, first type (This will list all your deployments):

kubectl get deployments --all-namespaces

Next you will use this (Bold one is specific to this project):

kubectl delete -n NAMESPACE deployment NAMEkubectl delete -n default deployment nginx-deployment

Now we can modify the deploy.yml.

vim deploy.yml

Click “I” for insert, and after the word “replicas” replace the “1” with a “4”, then save and quit.

Go ahead and deploy again:

kubectl apply -f deploy.yml

At this point, switch over the the Desktop Docker, and under “Containers” you can see all of them that you deployed!

Now back at the command line, type:

kubectl get deployments

There they are again!

Now to clean up, we will run the same delete commands as before:

kubectl delete -n default deployment nginx-deployment

I hope this was fun for you, and that you have a better understanding of why Kubernetes is quickly taking over the playing field!

Thanks for your time!

--

--

Dane Forslund

DevOps | Cloud | AWS enthusiast. I believe my most successful moments have derived from patient leadership, proactive resolve, and often adversity.