2. 2
The process of developing a software product using software engineering principles and
methods is referred to as software evolution.
Evolution of software development
3. 3
Evolution of infrastructure
the applications have the necessary libraries and binaries isolated from the rest of the system,
and cannot be encroached by any other application.
4. 4
Kubernetes is an open-source container management tool which holds the responsibilities of
container deployment, scaling & descaling of containers & load balancing.
Created by google in 2014.
What’s kubernetes?
7. 7
Docker provides the lifecycle management of containers and a Docker image builds the
runtime containers. But, since these individual containers have to communicate, Kubernetes is
used. So, Docker builds the containers and these containers communicate with each other via
Kubernetes.
How is Kubernetes related to Docker?
9. 9
➔ Cluster is a set of physical or virtual machines used by kubernetes to run applications.
➔ Node is physical or virtual machine on which pods can be deployed
➔ Minikube is a tool that makes it easy to run Kubernetes locally. This runs a single-node
kubernetes cluster inside a virtual machine.
➔ Namespace allows segmenting secret volumes pods …
➔ Pod: All containers will run in a pod. Pods abstract the network and storage away from
the underlying containers. Your app will run here.
➔ Kube Proxy: Responsible for forwarding app user requests to the right pod.
Concepts
10. 10
➔ API Server: The application that serves Kubernetes functionality through a RESTful
interface and stores the state of the cluster.
kubectl proxy --port=8080 & curl http://localhost:8080/api/v1
➔ Kubectl is the platform using which you can pass commands to the cluster. So, it basically
provides the CLI to run commands against the Kubernetes cluster with various ways to
create and manage the Kubernetes component.
➔ Kubelet is an agent service which runs on each node and enables the slave to
communicate with the master.
Concepts (2)
12. 12
Containers
Programs running on Kubernetes are packaged as Linux containers. Containers are a widely
accepted standard, so there are already many pre-built images that can be deployed on Kubernetes.
13. 13
Pod
Unlike other systems you may have used in the past, Kubernetes doesn’t run containers directly;
instead it wraps one or more containers into a higher-level structure called a pod. Any containers in
the same pod will share the same resources and local network. Containers can easily communicate
with other containers in the same pod.
Pods are used as the unit of replication in Kubernetes.
14. 14
Deployment
Although pods are the basic unit of computation in Kubernetes, they are not typically directly
launched on a cluster. Instead, pods are usually managed by one more layer of abstraction: the
deployment.
If a pod dies, the deployment will automatically re-create it.
16. 16
Kubernetes Manifest
YAML file to declare desired state of Kubernetes object types.
● Define Kubernetes type
● Define type specification
● Labels / Annotations
● Metadata
Kubectl apply/create -f fileName.yml/yaml/json
17. 17
Replica set and replication controller
Replica Set and Replication Controller do almost the same thing. Both of them ensure that a
specified number of pod replicas are running at any given time. The difference comes with the
usage of selectors to replicate pods.
Example:
Replication controller: Suppose your label key says app=nginx, then, with this selector, you can
only look for those pods with label app equal to nginx.
Replica set: Say your label key says app in (nginx, NPS, Apache). Then, with this selector, if
your app is equal to any of nginx, NPS, or Apache, then the selector will take it as a true result
18. 18
Replication controller
The replication controller makes sure that
few pre-defined pods always exist. So in
case of a pod crashes, the replication
controller replaces it.
19. 19
Replica set
● Replica Set is the next-generation of Replication Controller
● Replica sets have a few more functionalities when compared to the replication controller.
20. 20
Rolling Deployments
The ReplicaSets can be managed by another high level resource called Deployments for
providing features for rolling out updates and handling their rollbacks.
Zero downtime application updates.
➔ Deployment must contain more than one replica.
➔ Pod are incrementally updated.
➔ Configurable update schema (max unavailable / available).
➔ Rollback to previous version.
22. 22
An abstract way to expose an application running on a set of Pods as a network service.
For example, suppose you have a set of Pods that each listen on TCP port 9376 and carry a
label app=MyApp:
Services
23. 23
Services in Kubernetes :ClusterIP
➔ A ClusterIP service is the default Kubernetes service. It gives you a service inside
your cluster that other apps inside your cluster can access. There is no external
access.
➔ If you can’t access a ClusterIP service from the internet, why am I talking about it?
Turns out you can access it using the Kubernetes proxy!
$ kubectl proxy --port=8080
http://localhost:8080/api/v1/proxy/namespaces/<NAMESPACE>
/services/<SERVICE-NAME>:<PORT-NAME>/
24. 24
Services in Kubernetes :NodePort
A NodePort service is the most primitive way to get external traffic directly to your
service. NodePort, as the name implies, opens a specific port on all the Nodes (the
VMs), and any traffic that is sent to this port is forwarded to the service.
25. 25
Services in Kubernetes :Load Balancer
A LoadBalancer service is the standard way to expose a service to the internet. On
GKE, this will spin up a Network Load Balancer that will give you a single IP address
that will forward all traffic to your service.
35. 35
Config map & secret
Config maps ideally stores application configuration in a plain text format whereas Secrets
store sensitive data like password in an encrypted format. Both config maps and secrets
can be used as volume and mounted inside a pod through a pod definition file.
● Config map:
kubectl create configmap myconfigmap --from-literal=env=dev
● Secret:
echo -n ‘admin’ > ./username.txt
echo -n ‘abcd1234’ ./password.txt
kubectl create secret generic mysecret --from-file=./username.txt --from-file=./password.txt
53. 53
Helm
Helm, it’s a package manager for Kubernetes, it is just like APT for Debian.
Example: Installation of the Prometheus:
helm install prometheus-operator stable/prometheus-operator -n monitor
● “prometheus-operator” is the name of the release. You can change this if you want.
● “stable/prometheus-operator” is the name of the chart.
● “monitor” is the name of the namespace where we are going to deploy the operator.
54. 54
Kubernetes Dashboard
Graphical user interface for interacting with a Kubernetes cluster
● Create, update, delete objects
● Visual representation of state
● Take care to properly secure
There are a few scenarios where you would use the Kubernetes proxy to access your services.
Debugging your services, or connecting to them directly from your laptop for some reason
Allowing internal traffic, displaying internal dashboards, etc.