Kubernetes: manifest, service and node architecture
Introductory Kubernetes memo: deployment, service, cluster IP, master node, worker nodes and basic kubectl commands.
An introductory Kubernetes memo: how a manifest describes an application, how a service exposes pods, and which components run on the master node and on the worker nodes.
Principle: manifest, deployment and service
With kubectl, you send a manifest to the Kubernetes API. The manifest describes the desired state:
kind: Deployment: the deployment holds aselector, which picks the managed pods by their labels, and a podtemplate(container image, labels, for examplea: f);kind: Service: the service groups the pods carrying those labels and gives them a stable entry point.
A service has a cluster IP (an address internal to the cluster) that load-balances traffic across the pods. To be reachable from outside, it is exposed through an external IP.
The "service per container" principle is described on microservices.io.
Architecture: master node and worker nodes
- Master node: the scheduler, the API server interface, the controller manager and the
etcdservice, which stores the configuration data. - Worker node: the
kubeletservice and the pods, which run the containers. The kubelet receives its instructions from the API server.
The next diagram shows two worker nodes: the first runs a pod with an nginx container, the second a pod with a PostgreSQL container. The manifest is applied with kubectl through the API server.
Checking the state with kubectl
kubectl get pods -n <namespace>
kubectl get deployments -n <namespace>
get pods lists the pods of the namespace with their status (Running, ContainerCreating...), the number of ready containers and their age. get deployments shows, per deployment, the number of ready, up-to-date and available replicas.