-
posts
-
What are Kubernetes Pods Anyway?
Recently I saw a tweet from the awesome Amy Codes (I really hope that’s her real name) about Kubernetes Pods: You know why containers in a pod are always scheduled together? It's cuz they're nested containers. Mind. Blown. — Amy Codes (@TheAmyCode) August 21, 2017 While it wasn’t 100% accurate (Containers aren’t really a thing. We’ll get to that in a bit) it did point out the fact that Pods are amazing things. It’s worth taking a look at Pods and containers in general and learn what they actually are. The Kubernetes documentation on Pods provides the best and most...
-
Building Go Applications with Google Container Builder
Gopher image Creative Commons Attribution 3.0 Unported (ja) by tenntenn Recently I wrote on Twitter about how doing CI right requires you to properly separate your build and run steps for your container images. The reason for this issue is that you want to keep your final image as small as possible for a number of reasons. The obvious reason is for performance but there are several other reasons. Keeping it small keeps the images simple and reduces the risk of bugs, and reduces the security attack surface. If you’re a Google Cloud junkie like me then Container Builder is...
-
Creating Smaller Docker Images Part #4: Static Binaries
This is the fourth post in a series on making smaller Docker images: static binaries. In the first post I talked about how to create smaller images by writing better Dockerfiles. In the second post I talked about how to squash layers using docker-squash to make smaller images. In the third post I wrote about how to use Alpine Linux as a smaller base image. In this post I’ll examine the ultimate when it comes to making smaller images: static binaries. What if your app didn’t have any dependencies and didn’t need anything at all except the app itself? This...
-
Creating Smaller Docker Images Part #3: Alpine Linux
This is the third post in a series on making smaller Docker images. In the first post I talked about how to create smaller images by writing better Dockerfiles. In the second post I talked about how to squash layers using docker-squash to make smaller images. These methods are great but they won’t help us if we choose large base images to start with! Let’s look at the example from the second post, the standard python image on Docker hub. If we look at the Dockerfile for this image, as of this writing, it’s based on a Debian jessie base...
-
Kubernetes Health Checks in Django
In a previous post I wrote about Kubernetes health checks. Since I’m a Python developer and a fan, I went about implementing it in Django. Health checks are a great way to help Kubernetes help your app to have high availability, and that includes Django apps. However, with Django it’s not quite as simple as it sounds. Health checks are a way for Kubernetes to ask your app if it’s healthy. They assume that your app can start up without being ready, and so don’t assume any ordering to the starting of apps. For that reason we need to be...
-
A Quick Look at the Kubernetes Python Client
For those of you that don’t know there is a new Python API client in the kubernetes-incubator project: client-python. There has been some high quality Python clients like pykube, but client-python can serve as the official Python client. The Structure of the Client client-python is a client that is mostly generated based on the swagger spec (UI). While pykube has the benefit of being totally idiomatic, client-python can support practically all of the endpoints and react quickly to changes in the API. client-python supports Python 3 and is currently tested against Python 3.4. Using the Python API Client Kubernetes provides...
-
How kubeadm Initializes Your Kubernetes Master
kubeadm is a new tool that is part of the Kubernetes distribution as of 1.4.0 which helps you to install and set up a Kubernetes cluster. One of the most frequent criticisms of Kubernetes is that it’s hard to install. kubeadm really makes this easier so I suggest you give it a try. The documentation for kubeadm outlines how to set up a cluster but as I was doing that I found how kubeadm actually sets up the master to be really interesting so I wanted to share that here. The Kubernetes Control Plane The Kubernetes control plane consists of...
-
Performing Maintenance on Pods
Kubernetes includes a feature called services which serve as a kind of load balancer for pods. When pods misbehave or otherwise stop working, sometimes you’ll want to remove the pod from the service without killing the pod. Services & Endpoints Each service has a list of endpoints for the service which correspond to the pods for that service. This list of endpoints is updated automatically with the IPs and ports for the pods based on a label selector defined on the service. This allows the service to be loosely coupled to the pods themselves. You can see the selector pattern...
-
Using Kubernetes Health Checks
I’ve seen a lot of questions about Kubernetes health checks recently and how they should be used. I’ll do my best to explain them and the difference between the types of health checks and how each will affect your application. Liveness Probes Kubernetes health checks are divided into liveness and readiness probes. The purpose of liveness probes are to indicate that your application is running. Normally your app could just crash and Kubernetes will see that the app has terminated and restart it but the goal of liveness probes is to catch situations when an app has crashed or deadlocked...
-
Google Cloud Platform HTTP Load Balancers Explained via the CLI
The Google Cloud Platform Load Balancers are based off of technology that Google developed for our applications. There are two types of load balancers, the Network (L3) Load Balancer and the HTTP (L7) Load Balancer. The HTTP Load Balancer is global so the same IP can be used everywhere in the world, but still supports very high scalability with no warmup. Setting up the HTTP Load Balancer is fairly straightforward in the Developers Console. You can create one in the Networks section of the console and create a load balancer. Once you’ve started creating an HTTP Load Balancer, you get...