Getting started guide for Kubernetes from scratch

Marcel Dempers
5 min readDec 4, 2019

--

Throughout my career I’ve been mostly focused on development. I used to be a C# .NET developer and dabbled in operations work, as I’ve always been involved in production deployments once code was written.

This gave me a good overview of all the frustrations that system admins and operations folks had, as well as the developer frustrations, since I’ve dealt with complex code myself.

Over the last 5 years, I’ve moved into a DevOps focused role, understanding both sides of the “Dev” and “Ops” fence. When Kubernetes came about, I was fortunate enough to be an active user of the technology.

I was hooked. The entire cloud native movement around Kubernetes and Docker containers was solving a lot of development and operational challenges I’ve seen throughout my career. Code no longer only “Works on my Machine” since docker container wraps all the dependencies into a process that only needs a Linux kernel. And Kubernetes automates all the operational work, so “Ops” can sleep at night. Servers and applications have automatic recovery, health probes, resource limits, auto scaling, scheduling advantages and much more, making it possible for operations to forget about SSH, and virtual machines configurations. Doesn’t matter which cloud provider it runs on, we talk to the same interfaces and Kubernetes makes it happen.

Kubernetes solves a lot of the traditional challenges. But as good as it sounds, there are always side effects. Kubernetes comes with it’s own unique challenges

One issue I face regularly, is that most guides and tutorials assume you have a lot of background knowledge about Linux, networks and other parts of the Kubernetes / Container stack.

I often see documentation say “Run go get xxxxx“ and I think to myself, What if the person does not have golang installed? Or “Download this .exe” And then immediately assume it’s enabled on the users PATH.What if the person does not know how to get the .exe enabled on the command line ? Not all developer and operation folks are Linux command line focused users, making it hard to grasp these concepts.

Developers are often hand-held by GUI’s and IDE’s where you press a button and you get a web server with a debugger attached, or a running cloud instance. We live in a world where developer experience is the focus. However, when you deal with a modern complex distributed system, once you face a problem, you simply fall off the stack. Your developer experience tool set won’t save you.

I like the idea of having a good balance between developer experience and basic knowledge of the stack. At minimum, you’ll want to be able to peak through the layers when things go wrong.

I think there are few basic concepts folks should know whether working directly or indirectly with Kubernetes.

I created several videos covering these topics. Let’s start with Docker

I usually recommend getting a basic understanding of containers and what the technology solves. It makes it easier to understand the reasons and purposes behind Kubernetes and how it orchestrates containers and decouples our applications from servers. It’s also a platform to build platforms which make it difficult for folks to understand it’s end game.

Once you understand the container basics, I have a similar take on Kubernetes.

That video explains all the concepts at high level. Let’s take a deeper look at each concept. To do that we’re going to need a Kubernetes cluster.

Don’t worry, I got you covered with a basic install and setup guide.

Docker for Windows makes it super easy to get a Kubernetes cluster up and running. Check it out and try it yourself. All the source code in these tutorials are on GitHub

Now that we’re setup, you’re going to have to become a command line guru. Let’s do that by setting upkubectlso we can start deploying stuff. It’s important to get a good grasp on the kubectl command line tool to interact with Kubernetes. You’ll see in my video that it’s a pretty well self-documenting tool, which has a built in --help flag that makes it easy to navigate and use.

First concept we want to cover is deployments. Kubernetes allows us to describe our deployment as a file which represents the system’s desired state. We tell Kubernetes about the container image we want to run, how many replicas we want, how we want it load balanced and monitored.

It automates the Ops work. Where operation folks used to write scripts and use automation tools, Kubernetes now deals with it and keeps our workloads running, even when a server reboots or becomes unstable.

Let’s deploy something!

In this video I’ll take you through deployments in Kubernetes, we’ll build an application and deploy it.

Now when we deploy containers on Kubernetes, we may want to add configuration files for our applications. Kubernetes has the concept of config maps for this. Let’s create one

Some configurations may be sensitive like passwords and keys. Kubernetes has a concept of secrets to deal with these. Let’s take a look at secret management in Kubernetes

Now that we have containers running, configured and good to go, let’s see how we can send HTTP traffic to our deployment. Kubernetes automates and abstracts how we deal with networking. We don’t have to configure load balancers, drain traffic manually and worry about IP addresses and DNS. To solve networking challenges Kubernetes has the concept of services. Let’s deploy one in this video 👇

Now although services can allow us to load balance external traffic, most of the time its better to use a proxy to expose your applications to the public internet.

Proxies help with SSL, they’re battle hardened for security and built to sit on the edge of networks by serving public traffic. They deal with routing traffic to different containers which we’d like to serve. Kubernetes makes it super easy to manage proxy servers and engineers need no knowledge of proxy configurations. This concept is called Ingress. Let’s deploy an Ingress controller and send public traffic to our service

So to summarise, we’ve covered all the basic Kubernetes objects and concepts:

  • Installation & Configuration
  • Deployments & Pods
  • Configuration & Secrets
  • Services
  • Ingresses

Kubernetes is a platform to build platforms, and the above are the stable building blocks which will give you a good head start in learning about Kubernetes. I’ve also covered a few other technologies for Kubernetes such as CI/CD tooling, monitoring and performance engineering tools. Be sure to check them out!

Until next time,

Peace!

--

--

No responses yet