Install Minikube on Ubuntu

28/12/2020
In this article I will show you how to install Minikube to test and learn Kubernetes locally on Ubuntu.

I am using Ubuntu 17.10 Artful Aardvark for the demonstration. Let’s get started.

Installing Minikube Dependencies:

Before we can start installing Minikube, we have to install some dependencies of Minikube. In this section, I will show you how to install the dependencies on Ubuntu.

First run the following command to update the package repository cache of your Ubuntu operating system.

$ sudo apt-get update

We need curl to download the Minikube binaries. You can install curl from the official Ubuntu repository with the following command:

$ sudo apt-get install curl

Minikube needs hardware virtualization enabled to work properly. Make sure you have VT-d or Virtualization enabled from the BIOS of your computer. Once you’re sure that hardware virtualization is enabled, you can install VirtualBox hypervisor software from the Ubuntu official package repository. Run the following command to install VirtualBox on Ubuntu:

$ sudo apt-get install virtualbox virtualbox-ext-pack

Press ‘y’ and then press to continue.

The installation should start.  While the installation is ongoing, VirtualBox may ask you accept the license agreement of VirtualBox Extension Pack. Just press <Tab> and then press <Enter> to accept it.

Then you should see the following window. Just select “<Yes>” and press <Enter>.  The installer should continue.

After a while the installation will be completed.


Downloading and Installing MiniKube:

Go to the Downloads directory in the User’s home directory with the following command:

$ cd ~/Downloads

Now you can download the minikube binary using curl with the following command:

$ curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64

‘minikube’ binary will be downloaded in the ~/Downloads directory.

If you run ‘ls’ command, you should see the ‘minikube’ binary in the Downloads directory.

By default, the ‘minikube’ binary file is not executable. We must make it executable for it to work.

It is easy to do so. Just run the following command:

$ chmod +x minikube

From the output of the ‘ls’ command, you can see that the file is not marked green. Which means it is executable.

Now we have to move the ‘minikube’ executable binary file to /usr/local/bin.

Run the following command to do that:

$ sudo mv -v minikube /usr/local/bin

‘minikube’ executable file should be moved to the desired location as you can see from the output of ‘mv’ command in the screenshot.

Now we have to download ‘kubectl’ binary.

Run the following command to download the ‘kubectl’ binary file with curl:

$ curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.8.0/bin/linux/amd64/kubectl

‘kubectl’ will be downloaded from the internet.

Once the download is complete, if you run ‘ls’ command, you can see that ‘kubectl’ binary file is not executable.

Now run the following command to make ‘kubectl’ binary file executable.

$ chmod +x kubectl

If you run ‘ls’, you should see that ‘kubectl’ binary file is marked green. So it is now an executable binary file.

Now move ‘kubectl’ to /usr/local/bin with the following command:

$ sudo mv -v kubectl /usr/local/bin

You can see from the output of ‘mv’ command that the ‘kubectl’ binary file is moved to the desired location.


Testing Minikube:

Now that everything is complete. You can start Minikube.

Start Minikube with the following command:

$ minikube start

If Minikube is running for the first time, it will download Minikube ISO file from the internet. It may take a while depending on your internet connection.

Minikube will also download the localkube binary from the internet after Minikube ISO is downloaded.

Once the downloads are complete, Minikube should start. As you can see from the screenshot.

You can get a list of all the Minikube pods with the following command:

$ kubectl get pod

You can see that I have no pod set up right now.

Let’s create a Minikube pod now.  I am going to create a simple ‘echoserver’ pod with kubectl.

You can create a ‘hello-minikube’ pod with the following command:

$ kubectl run hello-minikube –image=gcr.io/google_containers/echoserver:1.4 –port=8080

‘hello-minikube’ pod is created.

If you list the pod now, you should be able to see ‘hello-minikube’ pod. The pod is still being created as you can see from the “STATUS” ContainerCreating. Minikube will download the pod image from the internet.

After the download is complete, running the ‘kubectl get pod’ command will show that the pod is RUNNING, as you can see from the screenshot.

Now run the following command to expose the pod’s port.

$ kubectl expose deployment hello-minikube –type=NodePort

You can get the URL of the ‘hello-minikube’ pod with the following command.

$ minikube service hello-minikube –url

You can see that the URL is printed on the next line. You can use this URL to access the ‘echoserver’ service.

You can make a GET request to the service endpoint with curl as shown in the screenshot.

You can get the IP address and open ports of all the Minikube pods with the following command:

$ kubectl get service

You can also delete the ‘hello-minikube’ service with the following command:

$ kubectl delete service hello-minikube

You can see that the service is deleted.

We can also delete the ‘hello-minikube’ pod using the following command:

$ kubectl delete deployment hello-minikube

You can see that the STATUS of the pod changed to ‘Terminating’. It will be deleted shortly.

Once you’re done with your tests, you can stop Minikube with the following command:

$ minikube stop

You can see from the screenshot that Minikube is stopped.

So that’s how you install and use Minikube on Ubuntu. Thanks for reading this article.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Kubernetes Nodes and Pods

With enterprises trying to use container technology for production-level deployment, cluster management and orchestration...
28/12/2020

Kubernetes Horizontal Pod Autoscaler

Pods can be created as stand alone objects, or as a part of a scalable replica set or a deployment. Each of the latter...
29/12/2020

Minikube Tutorial Made Easy

Developers and system admins interested to learn Kubernetes have heard of Minikube. Kubernetes is a complex container orchestration...
29/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Mua Proxy V6 Nuôi Facebook Spam Hiệu Quả Tại Onetcomvn
03/06/2024

Hướng dẫn cách sử dụng ProxyDroid để duyệt web ẩn danh
03/06/2024

Mua proxy Onet uy tín tại Onet.com.vn
03/06/2024

Thuê mua IPv4 giá rẻ, tốc độ nhanh, uy tín #1
28/05/2024

Thuê địa chỉ IPv4 IPv6 trọn gói ở đâu chất lượng, giá RẺ nhất?
27/05/2024