Kubernetes Deploy Guide

Implementing DevOps with Kubernetes
Kubernetes Implementation
Summary
- Kubernetes Concepts
- Google Cloud Plataform — GCP
- Helm Package Manager
- Cheat Sheet
- K3S
- References
1. Kubernetes Concepts

Kubernetes, also known as K8s, is an open-source system for automating deployment, scaling, and management of containerized applications.



Kubernetes Evolution from Google


Kubernetes Structure:
- Kubernetes is made available through a set of APIs
- We access the API using the CLI: kubectl
- Everything is state-based.
- Object State is set
Kubernetes Master:
- Kube-apiserver
- Kube-controller-manager
- Kube-scheduler
Others Nodes:
- Kubelet
- Kubeproxy
Kubernetes Dynamics

Cluster with 2 Nodes and 3 Pods
- Cluster — Set of Machines (Nodes)
- Each Machine has vCPU & Memory
- Pods — is a unit of provision containers
- The Pod show Processors Running inside the Cluster
- Deployment is a Proviosion
- Reply Sets

Pods

Kubernetes Cluster
K8S is a new Operating System of Cloud
- Container Orchestration
- Watch the container in action
- Check the health of the container
- Create a container in case the other one has fallen
- Automatically scale new containers based on load
- Load balancer
- Service Discovery
- Password Management
- Configuration File Management
- Security Management
Kind — Kubernetes on Doker

Kind

Kind — Kubernetes IN Docker
Pods — Kubernetes on Doker
Objectives
- Learn about Kubernetes Pods.
- Learn about Kubernetes Nodes.
- Troubleshoot deployed applications.
Kubernetes Pods
When you created a Deployment in Module 2, Kubernetes created a Pod to host your application instance. A Pod is a Kubernetes abstraction that represents a group of one or more application containers (such as Docker), and some shared resources for those containers. Those resources include:
- Shared storage, as Volumes
- Networking, as a unique cluster IP address
- Information about how to run each container, such as the container image version or specific ports to use
A Pod models an application-specific “logical host” and can contain different application containers which are relatively tightly coupled. For example, a Pod might include both the container with your Node.js app as well as a different container that feeds the data to be published by the Node.js webserver. The containers in a Pod share an IP Address and port space, are always co-located and co-scheduled, and run in a shared context on the same Node.
Pods are the atomic unit on the Kubernetes platform. When we create a Deployment on Kubernetes, that Deployment creates Pods with containers inside them (as opposed to creating containers directly). Each Pod is tied to the Node where it is scheduled, and remains there until termination (according to restart policy) or deletion. In case of a Node failure, identical Pods are scheduled on other available Nodes in the cluster.
Pods overview
- pod.yaml

Kubernetes Pods
Nodes
A Pod always runs on a Node. A Node is a worker machine in Kubernetes and may be either a virtual or a physical machine, depending on the cluster. Each Node is managed by the control plane. A Node can have multiple pods, and the Kubernetes control plane automatically handles scheduling the pods across the Nodes in the cluster. The control plane’s automatic scheduling takes into account the available resources on each Node.
Every Kubernetes Node runs at least:
- Kubelet, a process responsible for communication between the Kubernetes control plane and the Node; it manages the Pods and the containers running on a machine.
- A container runtime (like Docker) responsible for pulling the container image from a registry, unpacking the container, and running the application.
Node overview

Kubernetes Nodes
Replica Set
- rs.yaml



2. Google Cloud Platform (GCP)


3. Helm Kubernet Package Manage

[postgresql 10.15.1 · bitnami/bitnami
Chart for PostgreSQL, an object-relational database management system (ORDBMS) with an emphasis on extensibility and on…artifacthub.io](https://artifacthub.io/packages/helm/bitnami/postgresql "https://artifacthub.io/packages/helm/bitnami/postgresql")
PostgreSQL
PostgreSQL is an object-relational database management system (ORDBMS) with an emphasis on extensibility and on standards-compliance.
For HA, please see
$ helm repo add bitnami https://charts.bitnami.com/bitnami
$ helm install my-release bitnami/postgresql
Introduction
This chart bootstraps a PostgreSQL deployment on a Kubernetes cluster using the Helm package manager.
Bitnami charts can be used with Kubeapps for deployment and management of Helm Charts in clusters. This chart has been tested to work with NGINX Ingress, cert-manager, fluentd and Prometheus on top of the BKPR.
Prerequisites
- Kubernetes 1.12+
- Helm 3.1.0
- PV provisioner support in the underlying infrastructure
Installing the Chart
To install the chart with the release name my-release:
[Artifact Hub
Find, install and publish Kubernetes packagesartifacthub.io](https://artifacthub.io/ "https://artifacthub.io/")

4. Cheat Sheet



5. K3S
curl -sfL https://get.k3s.io | sh -
# Check for Ready node,
takes maybe 30 seconds
k3s kubectl get node
sudo k3s server &
# Kubeconfig is written to /etc/rancher/k3s/k3s.yaml
sudo k3s kubectl get node
# On a different node run the below. NODE_TOKEN comes from /var/lib/rancher/k3s/server/node-token
# on your server
sudo k3s agent --server https://myserver:6443 --token ${NODE_TOKEN}

MiniKube x Kind x K3s


6. References
- https://kubernetes.io
- https://acloudguru.com/blog/engineering/kubernetes-cheat-sheet
- https://intellipaat.com/blog/tutorial/devops-tutorial/kubernetes-cheat-sheet/
- https://caylent.com/kubectl-commands-cheat-sheet
- https://kind.sigs.k8s.io/docs/design/initial/
- https://kubernetes.io/docs/tutorials/kubernetes-basics/explore/explore-intro/




