Getting To Know K8s | A Blog Series About All Things Kubernetes

By Steven Eschinger | January 5, 2017

Kubernetes Logo

This post was updated on September 18th, 2017 for Kubernetes version 1.7.6 & Kops version 1.7.0

Introduction

Kubernetes (“K8s” for short) is open-source container orchestration platform used to automate the deployment, scaling and management of containerized applications. It was created by Google in 2014 and is built upon their 10+ years of experience running containerized production workloads on a large scale.

Even though Kubernetes has only be around for a couple years, it has already become the most popular container orchestration tool, beating out other major players in the space such as Apache Mesos and Docker Swarm. And some are saying that it is one of the fastest moving projects in the history of open source, based on an analysis of GitHub repository activity.

For somebody who is new to Kubernetes, it can be difficult to know where to get started. For example, there are currently 40 different ways to deploy a Kubernetes cluster, depending on the IaaS provider you are using, the configuration management system you have in place and what type of networking model you want to use.

The following blog series will take you through various parts of Kubernetes, such as deploying and maintaining a single cluster, deploying & managing applications, integrating a cluster with some common CI/CD tools (e.g., Jenkins, Travis CI, Wercker) and how to setup a federation between multiple clusters.

Audience

The target audience for this blog series is anyone who is just getting started with Kubernetes and wants to get some hands-on experience.

In the following labs, we will be using Amazon AWS as the IaaS provider, so a general understanding of the following AWS services would be helpful:

  • VPC - Virtual Private Cloud
  • S3 - Simple Storage Service
  • EC2 - Elastic Compute Cloud
  • ELB - Elastic Load Balancing
  • Route 53 - DNS Web Service

And although it is not mandatory, it would be good to familiarize yourself with the following Kubernetes concepts:

  • Cluster Master - Runs the components that provide the cluster’s control plane, such as the API server, etcd, controller manager and the scheduler.
  • Cluster Nodes - Worker machines, previously known as minions, which have the services needed to run Pods.
  • Pods - Running process in a cluster, which encapsulates an application container(s), storage resources, a unique network IP and the options that govern how the container(s) should run.
  • Replica Sets - Ensures that a specified number of Pod “replicas” are running at any one time.
  • Deployments - Provides declarative updates for Pods and Replica Sets in order to maintain their desired state.
  • Services - Defines a logical set of Pods and a policy by which to access them. Service types include ClusterIP, NodePort and LoadBalancer.
  • Namespaces - Sometimes called virtual clusters, they provide the mechanism to partition resources created by users into a logically named group.
  • Secrets - An object that contains a small amount of sensitive data such as a password, token or key. Can be retrieved by Pods with a reference.
  • Federation - Makes it easier to manage multiple clusters by enabling cross cluster discovery and providing the ability to sync resources across clusters.
  • kubectl - Command line interface for running commands against Kubernetes clusters.
  • Kops - Stands for “Kubernetes Operations”, it allows you to deploy production-grade, highly-available K8s clusters from the command line.

Getting Started

All of the following posts in this blog series are structured as individual labs and although it is not required to go through them sequentially, it is recommended.

Prerequisites

AWS Account: Amazon will be the IaaS provider we will be using and therefore you will need to have an AWS account. If you don’t have an account, you can sign-up for an AWS Free Tier account, which will give you a certain amount of usage of specific AWS resources for free each month for 12 months.

AWS Route 53 Domain: In addition to the AWS account, you will also need to have a public domain hosted in AWS Route 53, which is a requirement to deploy clusters with Kops. If you don’t already have a domain in Route 53 that you can use, refer to the Kops documentation for instructions on how to setup one of the three supported scenarios.

GitHub Account: We will be creating a demo website with Hugo, which will be used in multiple labs. The source for the Hugo site will need to be stored in a GitHub repository owned by you. If you don’t already have a GitHub account, you can create a free account here.

Docker Hub Account: The Docker images for the Hugo site need to be stored in a Docker Hub repository owned by you. If you don’t already have a Docker Hub account, you can create a free account here.

Warning: Some of the AWS resources that will be created in the following labs are not eligible for the AWS Free Tier and therefore will cost you money. For example, running a three node cluster with the suggested instance size of t2.medium will cost you around $0.20 per hour based on current pricing.

GitHub Repository

There is a single GitHub repository which covers all of the labs.

Lab Environment

For the execution of the labs, you can choose to use the provided Vagrantfile to provision a Vagrant box which has everything you will need already installed or you can install the required tools on your local host:

Next Up

In the first lab, Lab #1: Deploy a Kubernetes Cluster in AWS with Kops, we will go through the following:

  • Deploying a cluster in AWS using Kops
  • Checking the status of the cluster and the cluster controlling services
  • Deleting a cluster

Labs in the Series


Are you interested in topics like this? Drop your email below to receive regular updates.
comments powered by Disqus