K8s

DevOps Kubernetes (K8s)

What K8s can do

  • Service discoery and load balancing
  • Storage orchestration
    • Local or Cloud based
  • Automated rollouts and rollbacks
  • self-healing
  • secret and configuration management
  • Use the same API across on-premise and every cloud providers

What K8s can NOT do

  • Does not deploy source code
  • Does not build your application
  • Does not provide application-level services
    • databases, cache

Local K8s

Type Nodes
Docker Desktop 1
MicroK8s Multiple nodes
Minikube Multiple nodes
Kind Multiple nodes

Docker Desktop

kubectl cluster-info

Kind (Kubernetes In Docker)

  • Runs on MacOS, Linux and Windows
  • Only Requires Docker
    • No need for another VM installation
    • Installs the nodes as container
  • Multi nodes
  • High Availability Control Plane
  • Define in YAML

Windows

choco install kind

MacOS

brew install kind

Minikube

  • Does NOT require Docker Desktop
  • Install on Linux, MacOS and Windows
  • An Hypervisor like VirtualBox is required

CLI

Configuration store locally

  • ${HOME}/.kube/config
  • C:\Users\{USER}\.kube\config
Commands Description
kubectl config current-context Get the current context
kubectl config get-context List all context
kubectl config use-context {CONTEXT_NAME} Set the current context
kubectl config delete-context {CONTEXT_NAME} Delete a context from the config file
kubectl config rename-context {OLD_CONTEXT_NAME} {NEW_CONTEXT_NAME} Rename a context from the config file

Quickly switch context

https://github.com/ahmetb/kubectx

# Instead of typing
kubectl config use context minikube

# Simply type
kubectx {CONTEXT_NAME}

# Windows
choco install kubectx-ps

# MacOS
brew install kubectx

# Ubuntu
sudo apt intall kubectx

Reference

Context


Reference

DevOps Kubernetes (K8s): Reference