Kubernetes Quick Ref.
This is a quick reference guide for kubernetes to help in reading higher level documents.
What is Kubernetes ?
Platform for managing containerized workloads and services
Cluster
A kubernetes cluster consists of following components.
- Node: Worker machine
- Pod: Running container in a node
- Control Plane: container lifecycle management API interface
Control Plane
- kube-apiserver: Frontend
- etcd: key-value store
- kube-scheduler: schedule pods to node
- kube-controller-manager: state manager, pushes cluster to desired state
- cloud-controller-manager: Cloud provider specific APIs
Node
- kubelet: wrapper for pod
- kube-proxy: inter pod network communication
- Container runtime: container provider runtime
Pod
set of running containers
DNS
almost required addon for a cluster to provide service/pod discovery.
kubectl
locally configure kubectl
- Install kubectl (varies based on OS and environment)
- requires config file
~/.kube/config
Config file is generated while creating the cluster. Remotely connecting to the cluster requires setup of kubectl. Major cloud providers give instructions to setup kubectl on remote machines with proper authentications.
kubectl config set-cluster test-cluster --server={path}
- verify the applied config
kubectl config view
Context
A context is a group of access parameters. Each context contains a Kubernetes cluster, a user, and a namespace. The current context is the cluster that is currently the default for kubectl: all kubectl commands run against that cluster.
kubectl config get-contexts # display list of contexts
kubectl config current-context # display the current-context
kubectl config use-context my-cluster-name # set the default context to my-cluster-name
Namespace
Kubernetes supports multiple virtual clusters backed by the same physical cluster. These virtual clusters are called namespaces.
When to Use Multiple Namespaces
Namespaces are intended for use in environments with many users spread across multiple teams, or projects. For clusters with a few to tens of users, you should not need to create or think about namespaces at all.
Workload
an application running on Kubernetes using a set of pods.