Skip to content

Files

Latest commit

 

History

History

k8s-the-hard-way

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Kubernetes the hard way

Kubernetes (K8S) is one of the most popular container orchestration tools available nowadays. It is available on all major cloud providers, which makes it easy to create a k8s cluster with a few clicks.

However, I believe is it important to learn how to install k8s from scratch, you can learn a lot just from the installation process. I am going to walk through how to install k8s from scratch in a development enviroment, using Linux container. Installation is further automated with Ansible.

 

Table of contents

 

Prerequisite

 

Getting Started

Clone this github repo:
git clone https://github.com/sayems/kubernetes.resources.git

Navigate to k8s-the-hard-way directory

$ cd kubernetes.resources/k8s-the-hard-way

Start Linux Container

Now run the following command to start the Linux Container:

ansible-playbook playbook.yml

Now, wait for Linux container to be ready. This might take a while to complete.

Login into Linux Container

After the LXD box has started you can login to the Linux Container to verify that it is running..

lxc exec loadbalancer bash
lxc exec controller-1 bash
lxc exec controller-2 bash
lxc exec controller-3 bash
lxc exec worker-1 bash
lxc exec worker-2 bash
lxc exec worker-3 bash

Now, exit from Linux Container by executing exit command in the terminal.

Test Ansible Connectivity
ansible -m ping all
192.168.199.11 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
192.168.199.22 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
192.168.199.31 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
192.168.199.21 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
192.168.199.12 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

 

top

 

Installing the Client Tools

Install CFSSL

The cfssl and cfssljson command line utilities will be used to provision a PKI Infrastructure and generate TLS certificates.

You can install cfssl and cfssljson with Homebrew by running the following command:

brew install cfssl

Install kubectl

The kubectl command line utility is used to interact with the Kubernetes API Server.

You can install kubectl with Homebrew by running the following command:

brew install kubernetes-cli

 

top

 

Provisioning Compute Resources

 

top

 

Provisioning the CA and Generating TLS Certificates

 

top

 

Generating Kubernetes Configuration Files for Authentication

 

top

 

Generating the Data Encryption Config and Key

 

top

 

Bootstrapping the etcd Cluster

 

top

 

Bootstrapping the Kubernetes Control Plane

 

top

 

Bootstrapping the Kubernetes Worker Nodes

 

top

 

Configuring kubectl for Remote Access

 

top

 

Provisioning Pod Network Routes

 

top

 

Deploying the DNS Cluster Add-on

 

top

 

Smoke Test

 

top

 

Cleaning Up

 

top