Kubernetes

Kubernetes - Two Steps Installation

Learn how to use Kubeadm to install Kubernetes in mins

ta-ching chen

4 minute read

Introduction

Long time ago, the way to install kubernetes was quite complicate. After kubernetes 1.4, we can use Kubeadm to install a kubernetes cluster with only two steps. Now, let’s start our journey.

Prequisite

  • Ubuntu 16.04

Installation

  • install.sh
#!/bin/bash
apt-get update && apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
apt-get update
# Install docker if you don't have it already.
apt-get install -y docker.io
apt-get install -y kubelet kubeadm kubectl kubernetes-cni

Rolling Updates with Kubernetes Deployments

Learn how to use Kubernetes Deployment to perfom rolling update

ta-ching chen

6 minute read

Deployment

The newer version of Kubernetes, official suggests using Deployment instead of Replication Controller(rc) to perform a rolling update. Though, they are same in many ways, such as ensuring the homogeneous set of pods are always up/available and also they provide the ability to help the user to roll out the new images. However, Deployment provides more functionalities such as rollback support.

Kubernetes - Assigning Pod to Nodes

Learn how to use Kubernetes nodeSelector to assign pod to particular nodes

ta-ching chen

2 minute read

Intro

Currently Kubernetes support nodeSelector, affinity and anti-affinity to constraint pod to run on paritcular nodes. In this post, you will learn how to assign pod to specifc nodes by nodeSelector.

Hands-On

Show Labels

$ kubectl get nodes --show-labels
NAME            STATUS    AGE       LABELS
192.168.1.1    Ready     4d        beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=192.168.1.1
192.168.1.2    Ready     4d        beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=192.168.1.2
192.168.1.3    Ready     4d        beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=192.168.1.3

Kubernetes - Pod

Intro to smallest deployable unit in Kubernetes

ta-ching chen

3 minute read

Pod

A Pod is a group of one or more containers and it is the smallest deployable unit in Kubernetes. Pod and VM (virtual machine) are similar in many ways:

  • Containers in pod share the same IP address and port space
  • Shared storage (volumes)
  • Relatively tightly coupled applications in one pod

Shared IP address and port space

Kubernetes applies IP at Pod scope. Containers within a pod share an IP address and port space, and can find each other via localhost. Its just like what we do in VM: one prcoess find others with localhost:port.

Also pod can be accessed by other pod in Kubernetes cluster, it helps developer no need to worry about how to access other containers cross hosts. However, normally we don’t access other Pod directly but using service instead and we will discuss it in later article.