Comments on How to Install and Configure Kubernetes and Docker on Ubuntu 18.04 LTS

Kubernetes is an open source platform for managing containerized applications. It is commonly used to manage Docker Containers. In this tutorial, I will show you step-by-step how to install and configure Kubernetes on Ubuntu 18.04 LTS, I will set up one master and two worker nodes.

19 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: nmentityvibes

I am getting the following error message when trying to install docker using "sudo apt install docker.io -y" as mentioned in this documentation. I am using Ubuntu 18.04.1 LTS (Bionic Beaver)". I have tried all possible ways but was not successful. Please help.

By: till

Which error do you get?

By: nmentityvibes

E: Package 'docker.io' has no installation candidate

By: Phi Huynh

Thanks, it works well for my case.

Phi

By: Eric

I am getting the following error in Step 2

rootd@instance-20190320-1031:/etc/apt# kubeadm init --pod-network-cidr=10.244.10.0/16 --apiserver-advertise-address=10.0.15.10 --kubernetes-version "1.11.0"

this version of kubeadm only supports deploying clusters with the control plane version >= 1.12.0. Current version: v1.11.0

root@instance-20190320-1031:/etc/apt#

 

By: Apoloj

Successfully deployed.my observations and solutions:+Setup Hosts: I set up hosts via VM.Installed the unbuntu server 18.04Ran minimal installationAdded the requirements below via cli

+Kubeadm Installation+Install Docker+Install Kubeadm PackagesIssue: not able to install repositoryResolved: installed software-properties-common right after host insallationsudo apt install apt-transport-https ca-certificates curl software-properties-common

Kubernetes Cluster InitializationIssue: sudo kubeadm init --pod-network-cidr=10.244.10.0/16 --apiserver-advertise-address=10.0.15.10 --kubernetes-version "1.11.0"Solution: change the kubernetes version to match my kubernetes-version "1.14.0" sudo kubeadm init --pod-network-cidr=10.244.10.0/16 --apiserver-advertise-address=YourMasternode_ip --kubernetes-version "1.14.0"

Adding Worker Nodes to the Kubernetes ClusterIssue: I was having trouble joining the worker nodes to the clusterSolution: Swap was turn on at the master node and turned it back offsudo swapoff -a

Issue: trouble setting yaml when cut/paste the script to viSolution: copy/paste the script to notepad++ matached the spacing from notepad++ on vi and it worked

TestingDeployed local Kubenetes successfully

Thank very much for the lab. I looked for days for one I could successfully complete.

By: Stallion

The Kube version that gets downloaded is not 1.14 . If you run into issue that says "this version of kubeadm only supports deploying clusters with the control plane version >= 1.12.0. Current version: v1.11.0"

 

Change the command to :sudo kubeadm init --pod-network-cidr=10.244.10.0/16 --apiserver-advertise-address=13.12.. --kubernetes-version "1.14.0"

 

Also if somebody runs into a problem that says :

"Unfortunately, an error has occurred:

        timed out waiting for the condition

 

This error is likely caused by:

        - The kubelet is not running

        - The kubelet is unhealthy due to a misconfiguration of the node "

 

Try changing the advertise id to 0.0.0.0 like:

sudo kubeadm init --pod-network-cidr=10.244.10.0/16 --apiserver-advertise-address=0.0.0.0 --kubernetes-version "1.14.0"

By: celsocesila

I get an error with coredns pods, they don't initialize properly and stay in CrashLoopBackOff.

The log shows:

2019-04-18T09:19:51.659Z [INFO] CoreDNS-1.3.1 2019-04-18T09:19:51.659Z [INFO] linux/amd64, go1.11.4, 6b56a9c CoreDNS-1.3.1 linux/amd64, go1.11.4, 6b56a9c 2019-04-18T09:19:51.659Z [INFO] plugin/reload: Running configuration MD5 = 599b9eb76b8c147408aed6a0bbe0f669 E0418 09:20:16.659817       1 reflector.go:134] github.com/coredns/coredns/plugin/kubernetes/controller.go:322: Failed to list *v1.Namespace: Get https://10.96.0.1:443/api/v1/namespaces?limit=500&resourceVersion=0: dial tcp 10.96.0.1:443: i/o timeout E0418 09:20:16.659817       1 reflector.go:134] github.com/coredns/coredns/plugin/kubernetes/controller.go:322: Failed to list *v1.Namespace: Get https://10.96.0.1:443/api/v1/namespaces?limit=500&resourceVersion=0: dial tcp 10.96.0.1:443: i/o timeout log: exiting because of error: log: cannot create log: open /tmp/coredns.coredns-fb8b8dccf-nsv69.unknownuser.log.ERROR.20190418-092016.1: no such file or directory

  

By: Enrique Corro

Thanks so much to the author. This is heads down the best guide I could find after days of frustration. Almost flowless. The only suggestion is to avoid the enforcement of K8 version which might lead to errors. There's a small skewness allows among component versions

By: Chaos234

Where is the full how to for a single server setup? Means that you have only one root server and please no ubuntu distro, debian is prefered here. Also how to partition correctly? With SWRAID-Lvl 1? LVM or not? Because LVM and Docker sounds for me as double virtualisation.

By: Rizky

lee@bro:~$ sudo kubeadm init --pod-network-cidr=172.16.1.0/24 --apiserver-advertise-address=172.16.1.91 --kubernetes-version "1.14.2"

[init] Using Kubernetes version: v1.14.2

[preflight] Running pre-flight checks

error execution phase preflight: [preflight] Some fatal errors occurred:

        [ERROR NumCPU]: the number of available CPUs 1 is less than the required 2

[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`

 

How to fix this error message ?

By: Svetlana

I just added --ignore-preflight-errors=all at the end of the command to bypass it becausde I am using a VM and have no way of adding another CPU :)

By: Xavier

Its a great tutorial.

I was able to run nginx and even a Go app that I had.

What I do miss (all tuts are over local minicubes) is to expose , for example, nginx to the internet.

I've tried with MetalLB, but the external IP its useless from outside the enviroment. 

Please, share with use how to simple access to your nginx at: 10.0.15.10 (your master).  

PS: I do belive your tutorial is for those who are trying to run K8 in baremetal or privte vps without cloud load balancers.

 

Thanks for the great work!!!

By: balaram.ramaswamy

Excellent, it worked as explained. nice tutorial.

By: ejez

I made a new project that facilitates installing kubernetes in ubuntu, and in general setting up web environments with an easy/quick way. It is made with ansible.

Check it here: https://aya-project.readthedocs.io

By: Daniel

The status of my pods is "NotReady"

 

NAME        STATUS     ROLES    AGE   VERSION

k8-master   NotReady   master   12h   v1.16.0

worker01    NotReady   <none>   59m   v1.16.0

worker02    NotReady   <none>   55m   v1.16.0

 

When I execute this command this is what I see.

$ kubectl describe node k8-master

Conditions:

  Type             Status  LastHeartbeatTime                 LastTransitionTime                Reason                       Message

  ----             ------  -----------------                 ------------------                ------                       -------

  MemoryPressure   False   Sat, 21 Sep 2019 09:28:42 -0700   Fri, 20 Sep 2019 21:00:20 -0700   KubeletHasSufficientMemory   kubelet has sufficient memory available

  DiskPressure     False   Sat, 21 Sep 2019 09:28:42 -0700   Fri, 20 Sep 2019 21:00:20 -0700   KubeletHasNoDiskPressure     kubelet has no disk pressure

  PIDPressure      False   Sat, 21 Sep 2019 09:28:42 -0700   Fri, 20 Sep 2019 21:00:20 -0700   KubeletHasSufficientPID      kubelet has sufficient PID available

  Ready            False   Sat, 21 Sep 2019 09:28:42 -0700   Fri, 20 Sep 2019 21:00:20 -0700   KubeletNotReady              runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized

 

What is this issue?

KubeletNotReady              runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized

By: baltazar

Hi!

I have exactly the same issue "What is this issue?

KubeletNotReady              runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized

 

Is anybody know what to do? Any suggestions or workaround will be much appreciated? 

Thx

By: matt

Thanks,  very good instruction. 

Docker part is a bit out of date.  should install docker CE

https://kubernetes.io/docs/setup/production-environment/container-runtimes/

By: Tuyen

good article . Thanks