Kubernetes

Dartmoor
2 min readMay 28, 2021

What does Kubernetes do?

It’s a “desired state management” tool. It helps to deploy applications with multiple replicas, maintains and monitors the deployment status.

What’s the pain point Kubernetes solved?

It automates the deployment process. It also automates the works of monitoring and maintaining the applications.

Main concept and framework

Master: the “brain” of Kubernetes.

  • Provides UI, API, CTL that allow users to submit deployment plans or query status.
  • Schedules deployments.
  • Monitors applications.

Worker: the places that the applications are deployed. A worker is usually a physical server.

Pod: a deployable unit in Kubernetes. One pod usually has one container, but it could also has more than one. Containers in the same pod are usually closely related.

Container: a docker (or other similar products) image that contains an applications.

Virtual network: a special network system that allows apps in pods/containers to talk to each other.

Service: a permanent IP address that is assigned to a pod. Could help to reduce the IP look up and work as a load balancer. Also, service is independent from the pod so if a pod dies and a new pod is created to replace it, the IP does not change.

Ingress: exposes the public URL address and talks to applications in the internal network.

ConfigMap: put the application config files outside of the containers so that we don’t need to rebuild the application to change the configs.

Secret: put the application config files that are confidential. For example, user name and password. The secret file will be encoded with base64.

Volumes: a config that specify the path of persistent storage. Could be local or remote file systems.

Deployment: a config that defines the whole deployment plans.

StatefulSet: the component that is used to manage the stateful applications deployments. Such as databases.

How does Kubernetes resolve this issue?

The user submit a config file with the host states they want, such as the applications to be deployed (pods and containers) and the number of replications.

Kubernetes master execute the deployments and keeps talking with workers to monitor and maintain the state.

If a worker is down, the master will find another worker to redeploy the applications on them.

Other products that is similar to Kubernetes?

Docker Swarm, MESOS

Questions?

What’s the limit of Kubernetes? What it cannot do?

A: Kubernetes doesn’t have good support for stateful applications such as databases. Kubernetes doesn’t manage persistent storage.

For images that are stateful, e.g. a database, if the pod dies, how does Kubernetes recover it? Could it recover the final states (such as data) as well?

A: Yes, Kubernetes use StatefulSet and Volumes to handle this issue. However, Kubernetes don’t have good support for it so many users decided to put database outside of Kubernetes.

How does master distribute the pods on workers? Does it relay on info like CPU usage or hard disk space?

A:??

--

--