From the course: Debugging Kubernetes
"Kubernetes is hard." Why? - Kubernetes Tutorial
From the course: Debugging Kubernetes
"Kubernetes is hard." Why?
- [Instructor] Kubernetes makes it possible to create, scale, deploy, and expose hundreds of thousands of containers anywhere in the world within a single cluster. Unfortunately, some design choices within Kubernetes has earned at the reputation of being complex, challenging, or just downright hard, and rightfully so. Kubernetes is made up of lots of moving parts, the control plane binaries, container runtimes, container network interfaces, container storage interfaces, and much more. Finding out why things went wrong can require sifting through each of these components, which can be challenging and time consuming. Furthermore, everything in Kubernetes is an API resource, and all of those resources are created with YAML or JSON files, like you can see over here. This can seem much more involved and daunting than, say, writing a plain English Ansible playbook. Finally, kubectl is the predominant way of interacting with Kubernetes. Since Kubernetes can do a lot, kubectl can too. As you can see from the snapshot of the help command from kubectl, there are a lot of sub commands, and all of those sub commands have a lot of command line flags and a lot of switches. There is a lot going on, and it can be overwhelming on first glance. Despite its complexity, it is absolutely possible to wrangle Kubernetes clusters and even have fun while doing it if you keep these four guiding principles in mind. First, Kubernetes is just six applications and a database, that's it. Whether you're playing around in a Cline cluster for the first time or troubleshooting a mission critical application in one of the largest AWS EKS clusters in the world, the core of Kubernetes is always the same. A scheduler, a cluster controller and cloud controller manager, the kubelet and kube-proxy, and the API server, all of which are sitting on top of a database, which is usually at CD. This is important to keep in mind because if something goes seriously wrong within a cluster, you can almost always fall back to one of these components during your troubleshooting and work your way up. Also, most Kubernetes deployments are inspired by kubeadm. Kubeadm is a tool that helps automate the creation of Kubernetes clusters from scratch. While it's possible to create new clusters without this tool, kubeadm makes this job significantly easier. Almost every flavor of Kubernetes uses kubeadm somewhere along the lines to create clusters. Knowing this makes complex troubleshooting easier because it narrows a sea of possibilities down to a few common patterns. We'll see this in action when we debug a broken Kubernetes worker towards the end of the course. But if you want to learn more about kubeadm right now, check out my Kubernetes: Provisioning for Infrastructure as Code core series right here on LinkedIn Learning. The other thing to keep in mind is that everything in Kubernetes is an API resource, like I said earlier. This is super important to keep in mind because this also means that everything in Kubernetes is served by an API that is usually running as a pod somewhere within your cluster. This makes it easier to find the haystack that your needle might be in. Finally, kubectl logs, describe, and get are your friends, use them. Kubectl describe gives you a human friendly representation of resources within your Kubernetes cluster. This might leave some details out, however, this is why kubectl get on the other hand is important. It gives you everything about a resource as seen from the Kubernetes cluster's point of view. Additionally, you can get that information in many different formats like YAML and JSON. Finally, kubectl logs, of course, gives you the logs coming from any pod in your cluster. Since you can solve most issues within your cluster using these three commands, we'll be using them a lot throughout this course.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.