{"id":2608,"date":"2025-02-14T04:17:10","date_gmt":"2023-01-08T17:34:00","guid":{"rendered":""},"modified":"2025-02-02T00:46:18","modified_gmt":"2025-02-01T23:46:18","slug":"how-to-install-and-configure-kubernetes-and-docker-on-ubuntu-18-04-lts","status":"publish","type":"post","link":"https:\/\/netcloud24.com\/knowledgebase\/how-to-install-and-configure-kubernetes-and-docker-on-ubuntu-18-04-lts\/","title":{"rendered":"Linux VPS &#038; VPS Windows Setup Guide | NetCloud24 and Configure Kubernetes and Docker on Ubuntu 18.04 LTS"},"content":{"rendered":"<p>\u00a0<\/p>\n<\/p>\n<h1>\u00a0<\/h1>\n<p>Kubernetes is an open-source container orchestration platform that automates the deployment, scaling, and management of containerized applications. Docker is the leading platform for containerization. In this guide, we will show you how to install and configure Kubernetes along with Docker on Ubuntu 18.04 LTS. Whether you&#8217;re using a  or another hosting provider, Kubernetes helps manage containers efficiently.<\/p>\n<h2>Prerequisites<\/h2>\n<p>Before you begin, ensure you have the following:<\/p>\n<ul>\n<li>An Ubuntu 18.04 LTS server, which could be hosted on a <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">UK Windows VPS<\/a>, <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Windows VPSVirtual Private Servers<\/a>, or another <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Windows VPS Hosting UK<\/a> solution.<\/li>\n<li>At least 2 GB of RAM and 2 CPUs for the master node.<\/li>\n<li>Root or sudo privileges on your server.<\/li>\n<\/ul>\n<h2>Step 1: Install Docker<\/h2>\n<p>Docker is a prerequisite for Kubernetes as it runs containerized applications. Install Docker by following these steps:<\/p>\n<pre><code>sudo apt update\r\nsudo apt install apt-transport-https ca-certificates curl software-properties-common\r\ncurl -fsSL https:\/\/download.docker.com\/linux\/ubuntu\/gpg | sudo apt-key add -\r\nsudo add-apt-repository \"deb [arch=amd64] https:\/\/download.docker.com\/linux\/ubuntu $(lsb_release -cs) stable\"\r\nsudo apt update\r\nsudo apt install docker-ce -y<\/code><\/pre>\n<p>Once installed, start Docker and enable it to start at boot:<\/p>\n<pre><code>sudo systemctl start docker\r\nsudo systemctl enable docker<\/code><\/pre>\n<h2>Step 2: Install Kubernetes (kubeadm, kubelet, and kubectl)<\/h2>\n<p>To install Kubernetes components, follow these steps:<\/p>\n<pre><code>sudo apt update\r\nsudo apt install -y apt-transport-https curl\r\ncurl -s https:\/\/packages.cloud.google.com\/apt\/doc\/apt-key.gpg | sudo apt-key add -\r\nsudo apt-add-repository \"deb http:\/\/apt.kubernetes.io\/ kubernetes-xenial main\"\r\nsudo apt update\r\nsudo apt install -y kubelet kubeadm kubectl\r\nsudo apt-mark hold kubelet kubeadm kubectl<\/code><\/pre>\n<h2>Step 3: Disable Swap<\/h2>\n<p>Kubernetes requires swap to be disabled on your system. You can disable swap by running:<\/p>\n<pre><code>sudo swapoff -a<\/code><\/pre>\n<p>To make this change permanent, edit the <code>\/etc\/fstab<\/code> file and comment out any swap entries:<\/p>\n<pre><code>sudo nano \/etc\/fstab<\/code><\/pre>\n<h2>Step 4: Initialize Kubernetes Control Plane<\/h2>\n<p>On the master node, initialize the Kubernetes control plane using <code>kubeadm<\/code>:<\/p>\n<pre><code>sudo kubeadm init --pod-network-cidr=192.168.0.0\/16<\/code><\/pre>\n<p>Once the initialization is complete, follow the instructions displayed on the screen to set up your environment. Run these commands as a regular user (not root):<\/p>\n<pre><code>mkdir -p $HOME\/.kube\r\nsudo cp -i \/etc\/kubernetes\/admin.conf $HOME\/.kube\/config\r\nsudo chown $(id -u):$(id -g) $HOME\/.kube\/config<\/code><\/pre>\n<h2>Step 5: Install a Pod Network Add-on<\/h2>\n<p>To enable communication between the nodes in your cluster, you need to install a pod network add-on. In this example, we will use Calico:<\/p>\n<pre><code>kubectl apply -f https:\/\/docs.projectcalico.org\/manifests\/calico.yaml<\/code><\/pre>\n<h2>Step 6: Join Worker Nodes to the Cluster<\/h2>\n<p>If you have additional nodes to add to your Kubernetes cluster, run the join command provided at the end of the <code>kubeadm init<\/code> process on each worker node. The command looks like this:<\/p>\n<pre><code>sudo kubeadm join your-master-ip:6443 --token  --discovery-token-ca-cert-hash sha256:<\/code><\/pre>\n<p>This command connects the worker nodes to the Kubernetes master.<\/p>\n<h2>Step 7: Verify the Kubernetes Cluster<\/h2>\n<p>Once your worker nodes are connected, verify the cluster status by running:<\/p>\n<pre><code>kubectl get nodes<\/code><\/pre>\n<p>You should see a list of nodes showing the status as &#8220;Ready&#8221;.<\/p>\n<h2>Step 8: Deploy an Application on Kubernetes<\/h2>\n<p>To ensure Kubernetes is working properly, deploy a test application. For example, deploy an Nginx container:<\/p>\n<pre><code>kubectl create deployment nginx --image=nginx<\/code><\/pre>\n<p>To expose the deployment as a service, run:<\/p>\n<pre><code>kubectl expose deployment nginx --port=80 --type=NodePort<\/code><\/pre>\n<p>Check the status of the service:<\/p>\n<pre><code>kubectl get svc<\/code><\/pre>\n<h2>Step 9: Secure Your Kubernetes Cluster with SSL (Optional)<\/h2>\n<p>If you want to secure your Kubernetes cluster with SSL, you can configure Let&#8217;s Encrypt with your Nginx ingress. First, install Certbot:<\/p>\n<pre><code>sudo apt install certbot python3-certbot-nginx -y<\/code><\/pre>\n<h2>Conclusion<\/h2>\n<p>By following these steps, you have successfully installed Kubernetes and Docker on Ubuntu 18.04 LTS. Whether you\u2019re using Kubernetes on a , <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Microsoft SQL VPS Windows<\/a>, or another <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Windows VPSVirtual Private Server Hosting<\/a>, Kubernetes provides an efficient platform for managing containerized applications.<\/p>\n<footer>\n<p>For more VPS hosting options, visit . They offer a variety of <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Windows VPSVirtual Private Servers<\/a> and <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Windows VPS Hosting UK<\/a> solutions tailored to your needs.<\/p>\n<\/footer>\n<div class=\"post-author-box\" style=\"border-top:1px solid #ddd;margin-top:20px;padding-top:15px;\">\n<p><strong>Author:<\/strong> \u0141ukasz Bodziony<\/p>\n<p><strong>Website:<\/strong> <a href=\"https:\/\/ca.netcloud24.com\" target=\"_blank\" rel=\"dofollow\">Windows VPS<\/a><\/p>\n<p><em>\u0141ukasz Bodziony is the CEO and founder of <a href=\"https:\/\/netcloud24.com\" target=\"_blank\" rel=\"dofollow\">NETCLOUD24<\/a>, a global VPS hosting brand proudly originating from Poland. With extensive experience in cloud computing, virtualization, and server management, he delivers high-performance <strong>Windows VPS<\/strong> and <strong>Remote Desktop Services (RDS)<\/strong> solutions to clients across Europe, North America, and beyond.<\/em><\/p>\n<p><em>His expertise covers a wide range of technologies, including <strong>Microsoft Azure<\/strong>, <strong>Proxmox VE<\/strong>, <strong>Amazon Web Services (AWS)<\/strong>, and numerous other virtualization and cloud platforms.<\/em><\/p>\n<p><em>Beyond running his hosting business, \u0141ukasz also provides <strong>professional paid server configuration and optimization services<\/strong> for companies and individuals. Outside of work, he is dedicated to caring for his children and building a secure future for them.<\/em><\/p>\n<p><em>If you are interested in working with him or need expert assistance with your hosting, cloud environment, or server setup, feel free to reach out via <a href=\"https:\/\/ca.netcloud24.com\" target=\"_blank\" rel=\"dofollow\">Windows VPS<\/a>.<\/em><\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0 \u00a0 Kubernetes is an open-source container orchestration platform that automates the deployment, scaling, and management of containerized applications. Docker is the leading platform for containerization. In this\u2026<\/p>\n","protected":false},"author":1,"featured_media":3421,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[],"tags":[14,12,11,23,20,21,22,17,7,8,6,10,18,19,15,24,16,5,13,9],"class_list":["post-2608","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-cheapvps","tag-cloudvps","tag-hostingvps","tag-rds","tag-rdscal","tag-remotedesktop","tag-remotedesktopvps","tag-servervps","tag-ukvps","tag-virtualserver","tag-vpshosting","tag-vpsserver","tag-vpssolutions","tag-vpswindows","tag-vpswithwindows","tag-windowsrds","tag-windowsserver","tag-windowsvps","tag-windowsvpshosting","tag-windowsvpsuk"],"jetpack_publicize_connections":[],"_links":{"self":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/2608","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=2608"}],"version-history":[{"count":0,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/2608\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/media\/3421"}],"wp:attachment":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=2608"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=2608"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=2608"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}