Lesson 1 of 4By Nikita Duggal
Last updated on Feb 12, 202110731Kubernetes has grown tremendously and is considered by many to be the best orchestration tool today. It attracts many professionals who are interested in DevOps. Big companies like eBay, PokemonGo, Spotify, and SoundCloud have all deployed Kubernetes.
Here is everything this getting started with Kubernetes tutorial covers:
Next in the getting started with Kubernetes tutorial, we will learn about some of the salient features of Kubernetes, like:
In simple words, Kubernetes is an open-source platform used to deploy and maintain a group of containers. In practice, Kubernetes is most commonly used alongside Docker for better control and implementation of containerized applications. Containerized applications mean bundling an application together with all its files, libraries, and packages required for it to run reliably and efficiently on different platforms.
Google initially developed Kubernetes—first introduced as a project at Google, and then as a successor to Google Borg. Kubernetes was initially released in 2014 to make it easier to run applications on the cloud. The Cloud-Native Computing Foundation currently maintains Kubernetes.
Upon completion of this getting started with Kubernetes tutorial, enhance your Kubernetes skills and gain credibility in the field with the Certified Kubernetes Administrator Training Course.
Kubernetes is a container management system. It is an open-source, portable system to automate the deployment and management of containers that eliminates many of the manual processes required to run applications on the cloud. In practice, Kubernetes is most commonly used alongside Docker for better control and implementation of containerized applications.
The following are a few differences between Kubernetes and Docker Swarm:
Kubernetes |
Docker Swarm |
---|---|
Developed Google |
Developed by Docker Swarm |
Has a vast open-source community |
Has a smaller community |
More extensive and customizable |
Less extensive and customizable |
Requires heavy setup |
Easy to set up files |
High fault tolerance |
Low fault tolerance |
Provides strong guarantees to cluster states at the expense of speed |
Facilitates fast container deployment in large clusters |
Manual load balancing |
Automatic load balancing |
Before diving any deeper in the getting started with Kubernetes tutorial, let’s first look at the hardware and software components of Kubernetes Architecture, and later learn about architecture too.
A node is the smallest unit of hardware in Kubernetes. It is a representation of a single machine in the cluster. A node is a physical machine in a data center or virtual machine hosted on a cloud, like Google Cloud Platform.
Kubernetes does not work with individual nodes; it works with the cluster as a whole. Nodes combine their resources to form a powerful machine known as a cluster. When a node is added or removed, the cluster shifts around the work as necessary.
To store data permanently, Kubernetes uses persistent volumes. Nodes combine their resources to form a powerful machine known as a cluster. When a node is added or removed, the cluster shifts around the work as necessary.
Containers are self-contained environments to execute programs. The programs are bundled up in a single file (known as a container) and then shared over a network. Multiple programs are added to a single container, with a limit of one process per container. Programs run on the Linux package as containers.
A pod represents a group of one or more application containers bundled up together and is highly scalable. If a pod fails, Kubernetes automatically deploys new replicas of the pod to the cluster. Pods provide two different types of shared resources: networking and storage. Kubernetes manages the pods rather than the containers directly. Pods are the units of replication in Kubernetes.
Pods cannot be launched on a cluster directly; instead, they are managed by one more layer of abstraction: the deployment. A deployment’s fundamental purpose is to indicate how many pods are running simultaneously. The manual management of pods is eradicated when deployment is used.
Ingress allows access to Kubernetes services from outside the cluster. You can add an Ingress to the cluster through either an Ingress controller or a load balancer. It can provide load balancing, SSL termination, and name-based virtual hosting.
Now that you know about the hardware and software components let’s go ahead and dive deep into the Kubernetes architecture.
Now that you know about the hardware and software components let’s go ahead with the getting started with Kubernetes tutorial and understand all about Kubernetes architecture, that has a master-slave architecture.
The master node is the most vital component responsible for Kubernetes architecture.
It is the central controlling unit of Kubernetes and manages workload and communications across the clusters.
The master node has various components, with each one having its process. They are:
Syntax - kubectl [flags]
The slave node contains the following components:
Next in the getting started with Kubernetes tutorial we’ll look at the New York Times as a practical use case of Kubernetes.
To conclude, the New York Times has gone from a ticket-based system for requesting resources and scheduling deployments to an automatic system using Kubernetes.
Next up in the getting started with Kubernetes tutorial, let us quickly dive in a demo.
1. Open the terminal on Ubuntu.
2. Install the necessary dependencies by using the following command:
$ sudo apt-get update $ sudo apt-get install -y apt-transport-https |
3. Install Docker Dependency by using the following command:
$ sudo apt install docker.io |
Start and enable Docker with the following commands:
$ sudo systemctl start docker $ sudo systemctl enable docker |
4. Install the necessary components for Kubernetes.
First, install the curl command:
$ sudo apt-get install curl |
Then download and add the key for the Kubernetes install:
$ sudo curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add |
Change permission by using the following command:
$ sudo chmod 777 /etc/apt/sources.list.d/ |
Then, add a repository by creating the file /etc/apt/sources.list.d/kubernetes.list and enter the following content:
deb http://apt.kubernetes.io/ kubernetes-xenial main
Save and close that file.
Install Kubernetes with the following commands:
$ apt-get update $ apt-get install -y kubelet kubeadm kubectl kubernetes-cni |
5. Before initializing the master node, we need to swap off by using the following command:
$ sudo swapoff -a |
6. Initialize the master node using the following command:
$ sudo kubeadm init |
You get three commands: copy and paste them and press and “enter.”
$ mkdir -p $HOME/.kube $ sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config $ sudo chown $(id -u):$(id -g) $HOME/.kube/config |
7. Deploy pods using the following command:
$ $ sudo kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/ master/Documentation/kube-flannel.yml $ sudo kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/ master/Documentation/k8s-manifests/kube-flannel-rbac.yml |
8. To see all pods deployed, use the following command:
$ sudo kubectl get pods –all-namespaces |
9. To deploy an NGINX service (and expose the service on port 80), run the following commands:
$ sudo kubectl run --image=nginx nginx-app --port=80 --env="DOMAIN=cluster" $ sudo kubectl expose deployment nginx-app --port=80 --name=nginx-http |
10. To see the services listed, use the following command:
$ sudo docker ps -a |
Kubernetes is the most widely used container management system in the world, and there are plenty of career opportunities surrounding technology. If this getting started with Kubernetes tutorial intrigues you and you think you are ready to start a career or jumpstart your existing IT career in the exciting field of cloud computing, you should check out our Certified Kubernetes Administrator Certification Training program. You learn everything you need to know to deploy applications in the cloud that perform the fastest and are the most manageable.
Nikita Duggal is a passionate digital nomad with a major in English language and literature, a word connoisseur who loves writing about raging technologies, digital marketing, and career conundrums.