# Kubernetes (K8s)

{% embed url="https://kubernetes.io/" %}

> The task of automating, managing and interacting with a large number of containers is known as orchestration.

### Pods <a href="#step6" id="step6"></a>

At the core of Kubernetes is the [Pod](http://kubernetes.io/docs/user-guide/pods/).

Pods represent and hold a collection of one or more containers. Generally, if you have multiple containers with a hard dependency on each other, you package the containers inside a single pod.

![fb02d86798243fcb.png](https://cdn.qwiklabs.com/tzvM5wFnfARnONAXX96nz8OgqOa1ihx6kCk%2BelMakfw%3D)

### Kubernetes Services <a href="#step4" id="step4"></a>

A service is a grouping of pods that are running on the cluster. Services are "cheap" and you can have many services within the cluster. Kubernetes services can efficiently power a microservice architecture.

Services provide important features that are standardized across the cluster: load-balancing, service discovery between applications, and features to support zero-downtime application deployments.

Each service has a pod label query which defines the pods which will process data for the service. This label query frequently matches pods created by one or more replication controllers. Powerful routing scenarios are possible by updating a service's label query via the Kubernetes API with deployment software.

{% embed url="https://www.cockroachlabs.com/blog/titanic-explains-kubernetes/" %}

Terminologies

* Pod : one or more containers
* ReplicaSet: multiple instances of a pod
* Deployment : running code on kubernetes
* Service : load-balancing
* Namespaces : isolation
* YAML : declarative deployments
* Helm : package manager for kubernetes

Providers

* Microsoft - Azure Kubernetes Service
* Microsoft - Azure Service Fabric

Kubernetes Deployment Strategies

* Recreate - version A is terminated then version B is rolled out
* Ramped - version B is slowly rolled out and replacing version A
* Blue/Green - version B is released alongside version A, then the traffic is switched to version B
* Canary - version B is released to subset of users, then proceed to a full rollout
* A/B Testing - version B is released to subset of users under specific conditions
* Shadow - version B receives real world traffic alongside version A and doesn't impact the response performance

{% embed url="https://enterprisersproject.com/article/2021/5/kubernetes-6-open-source-tools-to-test-clusters" %}
