BlogPost4 Mess with Kubernetes

2 minute read

Published:

Motivation

A note of what I learned about Kubernetes Service

Table of contents

A course on LinkedIn.

  1. Mission

  2. Overview of Kubernetes

  3. Testing Locally with Docker

  4. Running Kubernetes Locally with kind

  5. The first Kubernetes Manifests

  6. First Helm Chart

  7. Go live

  8. Conclusion

  9. Apendix

Introduction

Problem statement: deploy explore california website for touring around California. The AWS server will be used, the entire infrastructure deployed through Terraform and Jenkins, they wanted to use Capybara and Selenium tests against local copies of their website running inside container. The Environment has been a problem for 3 reason: resource scarcity, time-consuming maintainance, and faulty tests.

Dockers containers were used for local testing. But the requirements asked for AWS EC2 virtual machine or stored inside of S3 bucket. Virtual machines and their storages are the problem -> is expensive to maintain. Development environments have led to outages

Migrating to Kubernete can provide solution with scalability and flexibility.

Overview of Kubernetes

Recap about Docker (podman, rocket, Kubernetes).

  • Container are virtualised instances of operating system kernels

  • Think of the docker/container as a burger: (Image from Carlos Slide on LinkedIn learn)Docker

  • Container allows you to put files of your website and web server like Nginx into a few layers just like an application

  • The magic of container comes from containerD: docker files/images, docker API

Docker as scale is a problem

  • Controlling storage for the docker

  • Discovering them inside network

  • Security within docker environment

  • Kubernete is planet-scale container for container, make it is easy to find and manage.

Kubernete overview:

  • Pods are smallest unit of Kubernetes. K8s pods group similar container into a logical unit. Containers inside of K8s pods have the same IP address

  • K8s Deployment scales and manage multple Pods. Deployment provide a desired state for pods in an application

  • Services: provide a single IP address and a DNS record for a group of pods

  • Ingress: is a transition layer to make your app internet acessible

  • The whole architecture of K8s would look like this Docker_architecture

Quiz: You are creating a new Dockerfile. The first line of your Dockerfile has this statement: > FROM mysql:ubuntu Ubuntu is a Linux operating system.

A: Any Docker containers running on a Linux operating system can be created from this Docker image. Containers are virtualized operating system kernels. Since Ubuntu is a Linux-based distribution, any flavor of Linux will be able to host a Docker container running this image.

Testing Locally with Docker

Install docker -> very easy with homebrew or just download it from the website

Running Kubernetes Locally with kind