Kubernetes Overview

  • A Kubernetes cluster has one or more master nodes (for high availability purposes). A master node consists of the following core components:
  • etcd is used as a backing store for all the Kubernetes's cluster data.
  • controller manager is in charge of maintaining the state of the cluster, such as rolling updates, fault detection, auto-scaling, etc.
  • scheduler is responsible for scheduling Pods to proper worker nodes according to a predetermined scheduling policy.
  • apiserver provides a uniform entry for authentication, authorization, API registration, and resource operations. As a developer, this is the only component you need to interact in a Kubernetes master. When you run a Kubernetes CLI ( kubectl) command in a terminal, such as kubectl get pods, what happens is kubectl converts the command to an API request, sends it to apiserver and displays the results in the terminal.
  • A Kubernetes cluster has one or more worker nodes that are running in multiple zones. Each worker node is a Google Compute Engine (GCE) virtual machine and has the following core components:
  • kubele is responsible for maintaining the life cycle of Pods and containers.
  • kube-proxy provides service discovery and load balancing functionality for Kubernetes Services.
  • Namespaces: A Namespace is considered a virtual cluster in a Kubernetes cluster. It is used to separate projects and teams. In our system, each of our applications (a.k.a microservices) has two Namespaces, one for the demo environment and another one for the prod environment.
  • ConfigMaps: A ConfigMap is a Kubernetes object for storing non-confidential data in key-value pairs. It allows you to decouple environment-specific configuration from containers in your application, which makes your application easily portable. A Pod can consume data in a ConfigMap as environment variables or mount a ConfigMap as a Volume.
  • Secrets: A Secret is a Kubernetes object for storing sensitive configuration, such as passwords, API keys, and OAuth tokens, in key-value pairs.
  • Pods: A Pod is the smallest deployable unit that you can create in Kubernetes. A Pod consists of one or more containers. These containers have their own CPU & memory resources but need to share other computing resources, including storage and network. When a Pod is created, it will be scheduled to a proper Kubernetes worker node based on its predetermined policy. You can consider a Pod a virtual machine running in a Kubernetes cluster. We will take about this in the next chapter.
  • ReplicaSets: A ReplicaSet is used to maintain a stable set of replica Pods running at the same state at any given time. It is also used to guarantee the availability of a specified number of replica Pods.
  • Deployments & Stateful Sets: A Deployment provides declarative updates, such as rolling updates and rolling back, for Pod ReplicaSets.
    In other words, A Deployment ensures a group of identical Pods to achieve the desired state at any time. StatefulSets provides the same functionality. However, Deployments are used to manage stateless applications while StatefulSets are used to manage stateful applications.
  • Services: A Service is an object that exposes an application running as a set of Pods as a network service. A Service is responsible for load-balancing requests to your application’s Pods.
  • Connecting a GKE cluster: gcloud container clusters get-credentials <your_cluster> --region <region> --project <your_project> is the command for connecting to the given GKE cluster. You may need to check official docs for more details about connecting to a Kubernetes cluster with a specific cloud provider.
  • Switching current namespace: kubectl config set-context --current --namespace=<your_namespace> switches your current context (Namespace) to the given Namespace. This command is useful when you need to switch between the demo and prod environment for a microservice.
  • Create one or more Kubernetes objects: kubectl apply -f <a_yaml_or_json_file> can help you create one or more Kubernetes objects. The given file must be YAML or JSON formatted. You can put the specification of many Kubernetes objects into a single file as long as each object is separated with ---.
  • Get Kubernetes objects: kubectl get <object_type> can help you get a certain type of Kubernetes objects. Here are two examples of this command:

Reference

--

--

--

A software engineer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Dojo Experience so Far and Near-Future Roadmap

Creating reverse related objects with Django REST Framework

Developing Your Web3 Decentralized Application: 3 Things To Consider

Oracle Autonomous Database with REST API (ORDS) in action..

Beta Testing React Native Android Applications with Crashlytics

G9 Experiments: TheGreatest Hits (So Far)!

Actuator JMX MBeans and JConsole

Spring Boot Actuator JMX MBeans With Jconsole

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aaron Zhuo

Aaron Zhuo

A software engineer

More from Medium

What is Kubernetes

Top 10 Reason to use VMware Tanzu as K8S platform

Openshift 101

Running an NGINX Ingress Controller for each Kubernetes Namespace