Skip to main content

Integration & IT Modernization

How to Learn Kubernetes

Kubernetes is almost the de facto platform for container orchestration. There are some great alternatives but they are second to Kubernetes in terms of open-source momentum, vendor-supported offerings, and extensibility/customization. A growing number of companies are adopting Kubernetes too in order to standardize software delivery and run their apps more efficiently. If you are not regularly interfacing with the platform though or you are not involved with the project in some other way, then you might still be telling yourself, “I need to learn some Kubernetes.” Allow me to present a strategy for doing so.

Nice to Meet You, Kubernetes

Basic Concepts

With Kubernetes (often abbreviated to “Kube” or “K8s”), you should wrap your head around some basic concepts first. A Google search will help you with anything specific you need to know, but early on in my Kube journey I spent a lot of time in the Concepts section at kubernetes.io. Documentation is an important part of the Kubernetes project so I encourage you to consume what’s being developed. You should ultimately be comfortable describing fundamental Kubernetes resource objects like Pods, Deployments, and Services. You should begin to see the importance and power of Labels and Selectors. You should also acquire a basic sense of the Kubernetes architecture. I actually spent significant time perusing docs on kubernetes.io (the official Kubernetes site) before attempting anything hands-on. I would recommend looking at other sites too and reading their presentations of the concepts. CoreOS has a great introduction, for example.

Kubernetes cluster with concepts illustrated

Kubernetes cluster with concepts illustrated

kubectl (pronounced kube-c-t-l)

Everyone’s first Kubernetes cluster tends to be Minikube, which is very easy to download and install if you would like a K8s playground. You also need to install kubectl, the friendliest interface for Kubernetes APIs. The configuration for kubectl is stored in a KUBECONFIG file which may hold information for multiple contexts, which are user and cluster pairs for the same or different clusters. Also, feel free to pronounce “kubectl” however you want.

Sample output from kubectl

Sample output from kubectl

With kubectl and Minikube installed, type minikube start. When start-up is done, kubectl will be configured to point to the Minikube cluster. If using a different cluster then you should have the KUBECONFIG on hand somewhere. Try some commands and be sure to inspect the output. I find kubectl to be pretty intuitive and there are tons of tricks/shortcuts or default behaviors that are fun to discover:

cat $KUBECONFIG
kubectl config view
kubectl cluster-info
kubectl get nodes
kubectl get nodes -o wide
kubectl get all
kubectl get pods
kubectl get pods --all-namespaces
kubectl get all --all-namespaces

Take a look at the Cheat Sheet in the Reference section of kubernetes.io. Also, this is somewhat advanced but another great post from CoreOS on kubectl.

Your First Application(s)

Kubernetes is less interesting when it is not running any of your applications. Back on kubernetes.io, visit the Tutorials section. Start with Kubernetes 101 then move on to “Running a Stateless Application Using a Deployment.” Around this time, you should begin to feel confident with the concepts and what you are doing. If not, step back and review the concepts again, then try any other basic tutorials you find.

At some point, move on to something more complex and something closer to home. This means developing YAML, usually by starting with something that works then changing container images, ports, labels, persistence, etc. I always found running a Jenkins server on Minikube to be a simple and fun project. AcmeAir is another application I experimented with early on. You can find my resource definitions for AcmeAir here.

Helm is the official package manager for Kubernetes. Read about Helm, set it up with Minikube, then visit the Kubeapps Hub and work with some of the charts they have hosted there.

Whenever you submit a request via kubectl to the Kubernetes API server and successfully create resources, be sure to run kubectl again to check the result. Use the watch utility to see Pods get created and enter the Ready state just after requesting them. A fun experiment is to run watch in one terminal and kill pods in another terminal (kubectl delete po ), then witness the pod respawn. Note the pod will only respawn if part of a ReplicaSet, which Deployment objects manage for you, and if kube-scheduler is healthy in your cluster.

Continuing Education

“Kubernetes the Hard Way” by Kelsey Hightower

Kelsey is one of the dopest advocates for Kubernetes. His work includes this tutorial, a staple in K8s self-education. This tutorial takes some time and you should do this on Google Cloud, AWS, OpenStack, or some other cloud provider. If you enjoy infrastructure work, you will enjoy this tutorial. Expect to learn a lot including details about TLS configuration, how to use systemd, and the various Kubernetes processes on both node types. Kelsey makes updates pretty regularly so you may learn even more than that!

Tune in to the Community

A tight community of engineers and users drive the Kubernetes project. The Cloud Native Computing Foundation (CNCF) is the governing body for Kubernetes and many other open-source projects. Kube is considered the seed project of CNCF in fact but the CNCF landscape has sprawled in just two years. All major cloud providers now offer Kubernetes as a managed service. There are other players in the community (companies and individuals) worth following, as well.

Here’s a list of things you can do to stay plugged in:

  • Subscribe to KubeWeekly
  • Follow vendor blogs for updates to their respective offerings
  • Regularly spend time looking at different repos, issues, and pull requests on GitHub in the kubernetes organization
    • Use GitHub stars and follow community members on GitHub and Twitter
  • Apprenda, CoreOS, Docker, Heptio, Mesosphere, Rancher Labs, and Red Hat are other companies to follow. Check the list of Partners on kubernetes.io for more.
  • Follow the activity on Slack, Stack Overflow, and Twitter

K8sPort

K8sPort sponsors KubeWeekly, the newsletter I mentioned previously, but the site also gives rewards for sharing Kubernetes updates on Twitter, responding to issues on Stack Overflow, and other simple activities. K8sPort is another great way to tune in to the community, but also challenge yourself by looking at the Stack Overflow items and trying to respond.

Screenshot from K8sPort

Screenshot from K8sPort

Achieve Mastery

Become a Community Member

There are so many ways to contribute to the Kubernetes project and become a member. Now that you are fairly experienced, you should look for ways to give back. For example, developing or improving documentation, preparing talks, helping fellow users, and resolving GitHub issues/PRs are all good ways to contribute, but there are other options too. Get involved in discussions if nothing else, join or start a local meetup, and treat other Kubernetes enthusiasts as siblings in arms.

Kubernetes Certified Administrator Exam

This exam is fairly new but I have already heard about it being sufficiently difficult and fun, with a lot of hands-on troubleshooting across multiple clusters. CNCF hosts the curriculum for the exam. They also offer a course which is specifically designed as preparation for the certification, and you can purchase both at a discounted price. This includes a free retake of the exam within 12 months!

Bring Kubernetes to Your Organization

Undoubtedly, the best way to up your game with K8s is to bring it home to your organization and run some applications on the platform. There is a lot to consider in this, foremost of which is your organization’s current level of experience with application containers. A platform like Kubernetes necessitates transformation on multiple levels, at least if you are looking to standardize across the company. Not only will you master Kubernetes from a technical standpoint by trying to drive adoption, but you will unearth other issues in your company or software that will be a challenge to resolve.

 

I shared an outline of how to learn Kubernetes based on my own path and aspirations. There is a lot of material out there so do not limit yourself to the sources I called out. More importantly, never stop learning or presume to know everything as Kubernetes is moving fast.

Thoughts on “How to Learn Kubernetes”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Murad Korejo, Solutions Architect

More from this Author

Follow Us
TwitterLinkedinFacebookYoutubeInstagram