To interact with k8s cluster we have two major options
programatically by using REST API with json payloads
kubectl command line by using YAML manifests
When we interact with kubectl we create yaml manifest which has minimum details required where we express what we want rather than how it is done.
when we work with clusters especially container clusters we embrace cattle mindset (pet vs cattle)
Pods in k8s
A Pod is smallest unit of creation in k8s.
Container will exist inside Pod.
A Pod is collection of application containers and volumes running inside the same execution environment
Each container in a pod runs with in its own cgroup, but they share a number of Linux namespaces
Each Pod gets a unique IP address in k8s cluster. The containers running inside the Pod share the same Ip Address and port space, have the same host name
A Pod can have any number of containers, but ideally its not a good idea to run multiple containers in a Pod.
A Pod should represent a microservice/application so running one container is considered as best idea.
K8s Installation
K8s has wide variety of installation options
local machine:
minikube
kind
k3s
k3d
microk8s
Manual cluster installation:
kubeadm
Automatic cluster installation
kubespray
kops
RKE
KubeSphere
Kubermatic
Managed clusters
Azure Kubernetes Service
Elastic Kubernetes Service
Google Kubernetes Engine
We would be using Manual Cluster installation to start with and then move towards Managed clusters
Once the k8s is installed in any of the above approaches, we need to create manifests to deploy our applications.