Skip to content

Latest commit

 

History

History
55 lines (32 loc) · 3.61 KB

Ch02.md

File metadata and controls

55 lines (32 loc) · 3.61 KB

Chapter 2. Basics of Kubernetes

Kubernetes: An open-source system for automating deployment, scaling and management of containerized applications. source: kubernetes.io

Built from the Google project Borg.

02-02-Kubernetes_Lineage

LinkedIn Slideshare

Kubernetes is all about decoupled and transient services. Decoupling means that everything has been designed to not require anything else in particular. Transient means that the whole system expects various components to be terminated and replaced. A flexible and scalable environment means to have a framework that does not tie itself from one aspect to the next, and expect objects to die and to reconnect to their replacements.

Kubernetes deploy a large number of microservices. Other parties (internal or external to K8s) expect that there are many possible microservices available to respond a request, to die and be replaced.

The communication between components is API call-driven. It's stored in JSON but written in YAML. K8s convert from YAML to JSON prior store it in the DB.

Other solutions to Kubernetes are:

  • Docker Swarm
  • Apache Mesos
  • Nomad
  • Rancher: Container orchestrator-agnostic system. Support Mesos, Swarm and Kubernetes.

Kubernetes Architecture:

Kubernetes Architecture

Kubernetes is made of a central manager (master) and some worker nodes, although both can run in a single machine or node. The manager runs an API server (kube-apiserver), a scheduler (kube-scheduler), controllers and a storage system (etcd).

Kubernetes exposes an API which could be accessible with kubectl or your own client. The scheduler sees the requests for running containers coming to the API and find a node to run that container in. Each node runs a kubelet and a proxy (kube-proxy). Kubelet receives requests tu run containers, manage resources and watches over them in the local node. The proxy creates and manage networking rules to expose the container on the network.

A Pod consist of one or more containers which share an IP address, access to storage and namespace. A container in a pod runs an application, and the secondary containers supports such application.

Orchestration is managed though a series of watch-loops, or controllers that check with the API server for a particular object state, modifying the object until declares the desired state.

A Deployment is a controller that ensures that resources are available, and then deploys a ReplicaSet. The ReplicaSet is a controller which deploys and restart containers until the requested number of containers running. The ReplicationController was deprecated and replaced by Deployment.

There is also Jobs and CronJobs controllers to handle single or recurring tasks.

Labels are strings part of the object metadata used to manage the Pods, they can be used to check or changing the state of objects without having to know the name or UID. Nodes can have taints to discourage Pod assignment, unless the Pod has a toleration in the metadata.

There is also annotations in metadata which is information used by third-party agents or tools.

Tools:

  • Minikube which runs with VirtualBox to have a local Kubernetes cluster
  • kubeadm
  • kubectl
  • Helm
  • charts
  • Kompose: translate Docker Compose files into Kubernetes manifests

Lab 2.1: View Online Resources