27 – Tools- Kubernetes

Date: 7/5/2020

Welcome and greetings

  • Welcome to my worldwide listeners from Brazil to France to Sweden to Mexico to India….and all other nations of the world.

Recap of last episode

  • In our last episode, I discussed what a SME (subject matter expert) is in relation to technology work and how they can be used to bring value to your projects. They are specialists and should be treated as such and can be great allies to your projects.

Summary of this episode

  • In this episode,we are going to dive into the world of kubernetes. I’m going to talk about what it is and discuss some of the commands that you can use to start up your containers using kubernetes.

What’s in it for you?

  • By the end of this episode, you should have a good understanding of what kubernetes is and how it fits into the technology architecture when you talk about automation and devops.

Episode Content

  • What is kubernetes?
    • According to wikipedia, Kubernetes is an open-source container-orchestration system for automating computer application deployment, scaling, and management.
    • Easy answer: it helps you run and manage your containers.
  • What is minikube?
    • According to the kubernetes.io website, Minikube is a tool that makes it easy to run Kubernetes locally. Minikube runs a single-node Kubernetes cluster inside a Virtual Machine (VM) on your laptop or server.
    • Easy Answer: it is a simple kubernetes test environment for you to learn in.

Some sample Kubernetes and Minikube commands:

  • minikube version
    • Display the version of minikube that is installed.
  • minikube start
    • Start the minikube cluster.
  • kubectl version
    • Display the kubernetes version information.
  • kubectl cluster-info
    • Display the information on the kubernetes cluster.
  • kubectl get nodes —help
    • Display information relating to the nodes that make up the kubernetes cluster.
  • kubectl get pods —help
    • Display extended help information related to the get pods command.
  • kubectl get services
    • Display information relating to the services running in the cluster.
  • kubectl describe pods
    • Display extended information relating to the pods where applications are deployed.
  • kubectl logs <pod_name>
    • Display the log information for a given pod_name.
  • kubectl exec <pod_name> <command>
    • Execute a command against a given pod_name.
    • ex. kubectl exec pod1 env
  • kubectl create deployment <deployment_name> –image=<container_image_location>
    • Create a deployment artifact from a given container image.
    • ex. kubectl create deployment kubernetes-app1 –image=hello-world:v1
  • kubectl get deployments
    • List information relating to the deployments that have been created in the cluster.
  • kubectl expose deployment/kubernetes-app1 –type=”NodePort” –port 8080
    • Open a communications port so that you can communicate with your applicatin that is running in the cluster.
  • kubectl describe deployment/kubernetes-app1
    • Show detailed information related to a given deployment
  • kubectl label pod $POD_NAME app=v1
    • Create a label for a given pod.
  • kubectl describe pods $POD_NAME
    • Show detailed information related to a given pod.
  • kubectl get pods -l app=v1
    • Show information related to a pod with a given label.
  • kubectl scale deployments/kubernetes-app1 –replicas=4
    • Increase or decrease running instances of the application to the specified number of replicas.
  • kubectl get deployments
    • Show information related to existing deployments.
  • kubectl get pods -o wide
    • Show pod information is wide format (similar to a linux ps command output).
  • kubectl scale deployments/kubernetes-app1 –replicas=2
    • Increase or decrease running instances of the application to the specified number of replicas.
  • # In the following, v10 does not exist so this will result in a failed deployment roll-out
  • kubectl set image deployments/kubernetes-app1 kubernetes-app1=gcr.io/google-samples/kubernetes-app1:v10
  • kubectl rollout status deployments/kubernetes-app1
    • This would show the failed roll-out fo the v10 container image.
  • #rollback
  • kubectl roll-out undo deployments/kubernetes-app1
    • This command would roll your application back to the last good version that was deployed.

Recap of this episode

  • In this episode, we discussed kubernetes. We talked about what it is and how you use it to run your containerized applications in a secure and scale-able way. We briefly talked about minikube and what it allows you to do. We then covered a list of commands and how they are used to tell kubernetes to deploy your containerized application and then scale it up or down depending on your need. We talked about some of the commands that let you troubleshoot your deployments and how to view the information relating to your application, pods, and the environment as a whole.

I’d like to thank you for joining me in this episode.

I hope that you found some value in what I covered and if you have suggestions for future topics, please feel free to drop me a message and I’ll be sure to review those to work into the schedule.

If you enjoy this podcast and the topics I cover, you can help me out by sharing the link with your friends. You can also give us a like or a thumbs-up where-ever you listen.

Please leave a review on your favorite podcast service as this will help me become better and ensure that I’m providing the value that you are looking for.

Before you leave, don’t forget to subscribe to ensure that you are notified of future episodes.

Next Episode: A quick discussion on Infrastructure as Code

Where you can find us!

Direct Messages:

  • @cs_everhart on Twitter
  • ScottTalksTech group on Facebook
  • ScottTalksTech.slack.com

Links to Podcast Providers: