<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>kubernetes on CodeBinge</title><link>https://www.thecodebinge.com/series/kubernetes/</link><description>Recent content in kubernetes on CodeBinge</description><generator>Hugo -- gohugo.io</generator><language>en-US</language><lastBuildDate>Mon, 09 Dec 2019 13:59:48 +0800</lastBuildDate><atom:link href="https://www.thecodebinge.com/series/kubernetes/index.xml" rel="self" type="application/rss+xml"/><item><title>Local Setup for Learning Kubernetes</title><link>https://www.thecodebinge.com/blog/2019-12/local-setup-for-learning-kubernetes/</link><pubDate>Mon, 09 Dec 2019 13:59:48 +0800</pubDate><guid>https://www.thecodebinge.com/blog/2019-12/local-setup-for-learning-kubernetes/</guid><description>Introduction There are multiple ways of setting up kubernetes. To play around or learn kubernetes you can set it up via multiple ways such as:
Minikube MicroK8s Kubeadm The kubeadm tool can also be used for setting up a local viable cluster with the help of a config management tools such as Ansible. A detailed step by step tutorial for installing kuberetes with ansible on a local cluster can be found here.
However for running a prodcuction grade cluster in cloud it&amp;rsquo;s better to use a managed service from providers such as GCP, AWS, Azure or DigitalOcean.
For a local development or learning setup minikube is the easiest to start with and we will go through steps to setup a local minikube cluster.
A typical kubernetes deployments consists of master and worker node with components shown in the image below.
Minikube bundles all these components together in a single node kubernetes cluser. This gives us a simple setup to work and interact with.
Installing Kubectl To interact with a kubernetes cluster we need a utility kubectl. The kubectl utility can interact with both local as well as a remote setup with some configuration.
Inorder to install kubectl utility on linux</description></item><item><title>Inspecting Kubernetes Objects</title><link>https://www.thecodebinge.com/blog/2019-11/inspecting-kubernetes-objects/</link><pubDate>Sun, 10 Nov 2019 13:59:48 +0800</pubDate><guid>https://www.thecodebinge.com/blog/2019-11/inspecting-kubernetes-objects/</guid><description>During a deployment the orchestrator performs some operations on the containers. To see the operations, we can make use of some commands which paints a clear picture on series of steps taken to reach the goal. The two main commands are logs and describe.
If you have followed the previous part till end then you can run the following commands else follow steps to create replica sets.
Log If we use the log command to inspect the deployment we created my-apache,
kubectl logs deploy/my-apache it spits out the following on the terminal.
Found 2 pods, using pod/my-apache-5d589d69c7-mb7wx AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.1.10.3. Set the 'ServerName' directive globally to suppress this message AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.1.10.3. Set the 'ServerName' directive globally to suppress this message [Thu Nov 21 14:23:27.128189 2019] [mpm_event:notice] [pid 1:tid 139734356759680] AH00489: Apache/2.4.41 (Unix) configured -- resuming normal operations [Thu Nov 21 14:23:27.150818 2019] [core:notice] [pid 1:tid 139734356759680] AH00094: Command line: 'httpd -D FOREGROUND' Inorder to inspect the pods based on some label, we can use the command
kubectl logs -l run=my-apache here -l is for label and when we created the replica sets for my-apache, by default a label is associated with the pods with the name of the cluster.</description></item><item><title>Kubernetes Deployment Strategies</title><link>https://www.thecodebinge.com/blog/2019-11/kubernetes-deployment-strategies/</link><pubDate>Sat, 09 Nov 2019 13:59:48 +0800</pubDate><guid>https://www.thecodebinge.com/blog/2019-11/kubernetes-deployment-strategies/</guid><description>Deployment strategies are methods use to deploy applications on Kubernetes.
Recreate Strategy Rolling Update Blue Green Strategy New deployment is made across the old deployment. Then the traffic is moved from old to new in one go.
deployment and service with label v1 create deployment with label v2 on kubernetes change label in service to v2
Canary In canary deployment a small percentage of requests are routed to the new deployment.
Comparison of different Strategies</description></item><item><title>Kubernetes Helm Charts</title><link>https://www.thecodebinge.com/blog/2019-11/kubernetes-helm-charts/</link><pubDate>Sat, 09 Nov 2019 13:59:48 +0800</pubDate><guid>https://www.thecodebinge.com/blog/2019-11/kubernetes-helm-charts/</guid><description/></item><item><title>Kubernetes Introduction</title><link>https://www.thecodebinge.com/blog/2019-11/kubernetes-introduction/</link><pubDate>Sat, 09 Nov 2019 13:59:48 +0800</pubDate><guid>https://www.thecodebinge.com/blog/2019-11/kubernetes-introduction/</guid><description>Basic Terms Kubernetes: The whole orchestration system for containers. Also called K8s. Kubectl: CLI to configure kubernetes and manage apps. Pronounces Kube-cuttle or kube-c-t-l. Node: A single server in kubernetes cluster. Kubelet: Kubernetes agent running on nodes. Control Plane(Managers): Set of containers managing the cluster. Runs APIs, DNS, Database, scheduler, etcd, controller manager etc. Control Plane(Master) etcd -&amp;gt; A distributed key value storage system which uses Raft consensus algorithm to manage a highly-available replicated log.
API -&amp;gt; A set of calls to talk to the kubernetes engine running on master nodes.
Scheduler -&amp;gt; Controls how or where containers are placed on nodes.
Controller Manager -&amp;gt; Looks at state of whole cluster using APIs. Receives orders from user and makes the system work accordingly.
Core DNS -&amp;gt; Manage networking.
Nodes(Workers) kubelet -&amp;gt;
kube-proxy -&amp;gt;
Installing locally To use kubernetes locally we can use MicroK8s. There are other ways to install, but I find this one, the most convenient.
Kubernetes Container Abstractions Pod: One or more nodes running together on one Node. - Basic unit of deployment. Containers are always in pod. Controller: For creating/updating pods and other objects. Many types of controllers Deployment, ReplicaSet, StatefulSet, DaemonSet, Job, CronJob etc.</description></item><item><title>Kubernetes Operators</title><link>https://www.thecodebinge.com/blog/2019-11/kubernetes-operators/</link><pubDate>Sat, 09 Nov 2019 13:59:48 +0800</pubDate><guid>https://www.thecodebinge.com/blog/2019-11/kubernetes-operators/</guid><description/></item><item><title>Kubernetes: PODs</title><link>https://www.thecodebinge.com/blog/2019-11/kubernetes-pods/</link><pubDate>Sat, 09 Nov 2019 13:59:48 +0800</pubDate><guid>https://www.thecodebinge.com/blog/2019-11/kubernetes-pods/</guid><description>PODS Kubernetes&amp;rsquo;s ultimate aim is to deploy an application in the form of containers on machines. Kubernetes doesn&amp;rsquo;t deploy containers directly, it encapsulates it into an object known as a pod. As the traffic increases to a cluster these pods are scaled to meet the demand. A pod can contain multiple containers of different types. Sometimes helper containers are deployed on the same pod however such instances are very rare. It&amp;rsquo;s a good practice to have only one container per pod as it keeps the architecture simple.
Containers and their use A genuine question comes to mind whenever we start with Kubernetes is why we need pods if there are containers. Containers are used for deploying a single application(process) in an isolated way. The main idea behind this philosohpy is that it becomes easier to manage logs, and if there is an exception then the orchestrator can restart the process. We will have hard time figuring out the issues if there are multiple processes running in a single container. Also, there might be a need that some of the services should keep running in case another fails, when a container goes down it brings all the processes to halt.</description></item><item><title>Kubernetes: Deployments</title><link>https://www.thecodebinge.com/blog/1-01/kubernetes-deployments/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.thecodebinge.com/blog/1-01/kubernetes-deployments/</guid><description/></item></channel></rss>