How To Install Kubernetes on Ubuntu

Kubernetes is a free and open-source container management framework providing a forum for automated deployment, scaling, and container operations across host clusters. You can use your hybrid, local and public cloud infrastructure free of charge with Kubernetes to operate your organisation’s deployment tasks. 

In this tutorial, we will illustrate the installation of Kubernetes in Ubuntu and deploy Kubernetes in a two-node Ubuntu cluster. 

Kubernetes (or, as is informally known, the K8s) is an open-source system which is used for containerized systems automation, scaling and management. Some of the advantages of Kubernetes include: 

Kubeadm automates Kubernetes components including API servers, Controller Manager and Kube DNS installation and setup. However, it does not build users or manage the installation and configuration of operating system dependencies. 

A configuration management tool like Ansible or SaltStack can be used for these preliminary tasks. The use of these tools makes it much easier and more feasible to create new clusters or to recreate existing clusters. 

Swap disabled. You MUST disable swap in order for the kubernetes to work properly.  

The commands and procedures specified in this article were executed on an Ubuntu 18.04 LTS framework. You can open all commands through either the Dash, or the Ctrl+Alt+T shortcut, as we will use the Ubuntu command line, the Terminal. 

The two-node cluster will consist of a Master Node and Slave Node. These two nodes must be installed with Kubernetes. 

Master Node: The master Node is responsible for the administration of the cluster state (a node in Kubernetes refers to a server). 

SlavNode: The servers on which your workloads (i.e., container applications and services) are running are worker nodes or slave nodes. When delegated, the workload is continued by a worker even though the master falls when the schedule is complete. By adding workers, the capacity of a cluster can be increased. 

Follow the steps below to install Kubernetes on the two nodes in Ubuntu. 

On both master and slave nodes, the following must be performed. 

1. Docker’s installation is the first thing to do. Login into the server to do this and export the command: 

How To Install Kubernetes on Ubuntu

In order to continue the installation, you will be asked to choose a Y/N option. Please enter Y to continue, then press Enter and your machine will be configured with Docker. 

2. The installation can also be checked by using the following instruction, and the Docker version number: 

How To Install Kubernetes on Ubuntu

You must add your user to the docker community once Docker is installed (otherwise you must carry out all the sudo docker commands which could lead to security problems). 

3. Use the command to connect your user to the docker group: 

Log out and log in, so that adjustments come into effect. 

4. Launch and activate the docker daemon with the commands: 

Now, install Kubernetes on both the machines. As Kubernetes is downloaded from a non-standard repository, it is essential for the software to be authentic. This is achieved with the addition of a signing key. 

1. Add the GPG Kubernetes key with the command:  

How To Install Kubernetes on Ubuntu

2. If curl is not installed on your system, then you can install it with the commands: 

In order to continue the installation, you will be asked to choose a Y/N option. Please enter Y, then press Enter. You will then install the Curl utility on your device. 

3. Sometimes Kubernetes is not added in default repository. To add the Xenial Kubernetes repository, runthe following command on both nodes: 

How To Install Kubernetes on Ubuntu4. Installing Kubeadm (Kubernetes Admin) on both nodes by command is the final stage of the installation process: 

Run the below command to check whether the versions of the components installed are compatible with each other. 

In order to continue the installation, you will be asked to choose a Y/N option. Please enter Y to continue, then press Enter. Kubeadm will then be installed on your device. 

5. You can also check Kubeadm’s version number and verify the installation using the following command: 

How To Install Kubernetes on Ubuntu

Repeat for each server node. 

Ensure that on each computer you install the same package version. Instability can arise from various versions. This mechanism also prevents Kubernetes from being updated automatically. 

1. Disable swap memory: 

You can deactivate the swap memory in both nodes because Kubernetes does not work properly on a swap-based device. Run the following command to disable swap memory on both nodes: 

2. Unique hostnames to each node: 

In order to facilitate things, each server needs to be assigned specific hostname. 

To assign it a unique hostname, run the following command in the master node: 

To assign it unique hostname, run the following command in the slave node: 

  In case of additional worker nodes, use the command to set a unique hostname on each. 

3. Initialize Kubernetes on Master Node: 

Switch to the master server node and type: 

You can find pod network CIDR in /etc/kubernetes/manifests/kube-controller-manager.yaml 

How To Install Kubernetes on UbuntuUpon completion of the command, a kubeadm join message is displayed at the end. Depending on your Internet connection, the process can take a minute or more. Make a note of the entire entry. This is used for joining the cluster’s nodes. 

You need to run the following as a daily user to start using your cluster: 

By running the following command, you can check the status of the master node: 

How To Install Kubernetes on Ubuntu

4. Deploy Pod Network to Cluster: 

A pod network is a communication medium between network nodes. 

This article uses the following command to deploy a Flannel pod network in our cluster: 

To display the network status, use the following command: 

How To Install Kubernetes on Ubuntu

5. Add the slave node to form a cluster: 

you can enter thekubeadm joincommand on each slave node to connect it to the cluster. 

Run the command that you created when you initialized Kubernetes on your master node at the slave node: 

How To Install Kubernetes on Ubuntu

This shows that the two-node cluster now operates via the container management system in Kubernetes.

1. Clear Pods 

Using this command, you can delete all the nodes: 

2. Remove  kubeadm completely 

How To Install Kubernetes on Ubuntu

Learn more about the core concepts of Kubernetes Components, Architecture, Pods and Deployment with Kubernetes Training Course. 

Conclusion: 

You should now have Kubernetes installed on Ubuntu, after following carefully the steps stated in this article. 

This network uses many servers for back-and-forth communication. You can launch and manage Docker containers on several servers on the pod from Kubernetes. 

The Kubernetes container management system installed on two Ubuntu nodes was discussed in this post. We then developed and deployed Kubernetes to a single two-node cluster. This clustered network is now available for use,and you can use any service like a Nginx server or Apache container. 

  • Automatic installation and machine rollback:  Kubernetes updates an interface progressively and monitors its health to ensure that all instances are not destroyed simultaneously. If something goes wrong, Kubernetes will reverse changes for us. 
  • Load balancing and service exploration: The Pods can be loaded by Kubernetes and can distribute IP addresses and DNS names for the collection of Pods. 
  • Repository orchestration: Users can install local or cloud storage systems automatically. 
  • Container automatic packaging: Kubernetes distributes containers automatically according to their resource specifications and other restrictions. The greater the allocation of the container and its resources, the better the device efficiency. 
  • Use of Kubernetes packages: Kubernetes can handle your package configurations, in addition to its services. 
  • Self-recovery: Kubernetes tracks the container situation and can substitute it with new containers if anything goes wrong. Containers are also recreated that are already destroyed. 
  • Kubeadm: automates Kubernetes installation and setup, including the API, Controller Manager and Kube DNS server.
  • Hardware Requirement:    

    • For Master: 
      • RAM: 2 GB 
      • CPU: 2 Cores  
    • For Slave: 
      • RAM: 1 GB 
      • CPU: 1 Core 
  • For Master: 
    • RAM: 2 GB 
    • CPU: 2 Cores  
  • RAM: 2 GB 
  • CPU: 2 Cores  
  • For Slave: 
    • RAM: 1 GB 
    • CPU: 1 Core 
  • RAM: 1 GB 
  • CPU: 1 Core 
  • Software Requirement:   

    • 2 or more Ubuntu 18.04 servers 
    • Access to a sudo or root privileged user account on each device 
    • The apt package manager. 
  • 2 or more Ubuntu 18.04 servers 
  • Access to a sudo or root privileged user account on each device 
  • The apt package manager. 
  • To assign it a unique hostname, run the following command in the master node: 

  • To assign it unique hostname, run the following command in the slave node: 

  • You need to run the following as a daily user to start using your cluster: 

  • By running the following command, you can check the status of the master node: 

  • This article uses the following command to deploy a Flannel pod network in our cluster: 

  • To display the network status, use the following command: 

  • Run the command that you created when you initialized Kubernetes on your master node at the slave node: 

  • So now you run the command on the master node, it confirms that your device has two nodes, the Master node and Server nodes. 
  • Research & References of How To Install Kubernetes on Ubuntu|A&C Accounting And Tax Services
    Source

    error: Content is protected !!