Kubernetes Concepts
Turn key solutions:
- RedHat OpenShift
- Vultr
- Linode
- Google Kubernetes Engine
- AWS
- Digital Ocean
Some terms:
- kubectl - control tool
- kubeadm - setting up clusters
- kind - to run on local computer
- minikube - run single node cluster on your computer
- k3s - mini kubernetes from Rancher Labs
Pods:
- kind of like application specific logical hosts
- resources
- shared storage volumes
- networking with unique cluster IP
- container info ( ports, image, etc. )
Nodes
- worker machine
- VM or physical
- multiple pods
- kublet
- container runtime
Service
- logical set of pods
- provides access to them
- type
- ClusterIP (default)
- setup internal IP within cluster
- also load balances
- NodePort
- expose with NAT
- also load balances
- 30000 - 32767
- LoadBalancer
- create load balancer with external IP (NEEDS third party LB!!!!)
- cloud only ?
- ExternalName - setup a DNS name
- ClusterIP (default)
More terms:
- Deployment - Used to create and update application instances.
- ReplicaSet - Pods can be run and failover within this.
-
Labels and Selectors - You can categorize things with these.
- CRI - Container Runtime Interface
Container runtimes:
- containerd
- CRI-O
- Docker Engine
- Mirantis Container Runtime
Important tips:
- best to only have one cgroup manager
- use systemd as cgroup manager
- set this with docker: native.cgroupdriver=systemd
- cgroups v2 can be installed
- docker runs containerd
Windows containers?
Deployment tools:
- Kubespray
- kops
- kubeadm
Nodes
* pods
* containers
Control plane
* kube-apiserver
* etcd - key store for cluster data
* kube-scheduler - assigns pods to nodes and probably more
* kube-controller-manager
* Node controller
* Job controller
* Endpoints controller
* Service Account & Token controllers
* cloud-controller-manager - only in the cloud
* Node controller
* Route controller
* Service controller
Node components:
- kubelet - makes sure containers in PodSpecs are running
- kube-proxy - manages network stuff for the node
- container runtime
Addons
- DNS ( Cluster DNS )
- Web UI ( Dashboard )
- Container Resource Monitoring
- Cluster-level Logging
API accessed with
- kubectl
- kubeadm
- REST
- API Objects: Pods, Namespaces, ConfigMaps, and Events
Objects:
- spec - what it should be
- status - what it currently is
- has name and UID
Object management:
- Imperative commands - adhoc commands ( good for dev )
- Imperative object configuration - objects defined in files ( good for prod ) WARN - could overwrite stuff
- Declarative object configuration - objects defined in files within a dir ( good for prod )
Namespaces
- isolation groups
- provide scoping
- good for teams and projects
kubectl get namespace
4 initial namespaces:
- default
- kube-system
- kube-public
- kube-node-lease
Terms to expand on:
- Labels and Selectors - these exist
- Annotations - these also exist
- Field Selectors - these exist too
- Finalizers - wait for condition before fully deleting, can block deletion
- Owners and Dependents - some objects own others
Field selector example:
kubectl get pods --field-selector status.phase=Running