K8s and the πŸ˜Άβ€πŸŒ«οΈ

k8s manages and orchestrates clusters of containerised applications, by abstracting over pools of computing resources cpu, network, memory & disk and abstracting deploying to a public cloud(s). via declarative yaml, json (but also imperative apis)

desired <-> observed <-> reconciliation

intuition/basic algorithm: https://en.wikipedia.org/wiki/Bin_packing_problem

hypervisors: https://pages.cs.wisc.edu/~remzi/OSTEP/vmm-intro.pdf

scheduling/orchestrating: https://fly.io/blog/carving-the-scheduler-out-of-our-orchestrator/

container = OCI runtime spec (docker-engine, containerd, etc)

trace nodes and pods:

kubectl get nodes -v=9
kubectl get pods -v=9

local dev tooling:

tilt
minikube
kind
k3d cluster create <name_cluster> <flags> <image>

tools to observe of performance, behaviour and health of software systems: metrics, logs & traces. tools to create/ provisioning and deployment packaging:

 helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm upgrade --atomic --install prometheus-community \
--create-namespace \
--namespace prometheus-community \
--values yourconfigtoobserverxyz.yaml \
prometheus-community/kube-prometheus-stack
helm
terraform

control plane:

and worker nodes run workloads - (vm) - pods, attached kubelet, kube-proxy

controller - (podtemplate, deployment) pods:

deploying pods: manifest or controller [net, pid, mnt, UTS, IPC] lifecyle: side car, adapter, ambassador, init

kubectl get pods <pod> -o yaml
kubectl describe pods <pod>
kubectl logs <pod>
kubectl exec -it <pod> -- sh #--container=<c>

namespaces: quotas + policies to sub-clusters of pods, services & deployments. (kube-system(dns, metrics) - control plane, kube-public, kube-node-lease(heartbeat))

kubectl api-resources
kubectl get svc --namespace kube-system
kubectl config set-context --current --namespace <ns>

deployments: (stateless pods/container mngmt) spec + controller viz replicaset |labels + selectors| to pod, exposing over an external IP

kubectl get | describe deploy <deployment>
kubectl get | describe rs # at least one replica set per deploy
kubectl scale deploy <deployment> --replicas 5
kubectl rollout (status | history) | pause | resume | rollback  deploy <deployment>

services: RESTful object - stable IP, DNS and port coupled & load-balances(endpoint slice) to pods via labels + selectors.

options:

ingress:

ingress class mix and match ingress controllers (nginx, istio etc) on a cluster

kubectl get ing
kubectl get ingressclass

service discovery in a k8s cluster:

kubectl get pods -n kube-system -l k8s-app=kube-dns
/etc/resolv.conf

data plane

spin up an ec2 jumpbox

todo: https://github.com/kelseyhightower/kubernetes-the-hard-way

https://docs.aws.amazon.com/ec2/latest/instancetypes/instance-types.html

#!/bin/bash

# exit on error
set -e
echo "Starting my ec2 box..."

# update
sudo apt-get update && sudo apt-get upgrade -y

# build and profiling
sudo apt-get install -y \
    build-essential \
    curl \
    wget \
    git \
    linux-tools-common \
    linux-tools-generic \
    linux-tools-`uname -r` \
    strace

# rs
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env

echo "Setup complete! Remember to 'source ~/.bashrc' to load the new environment variables"

spin up a compute engine

https://cloud.google.com/compute/docs/instances

Terraform