Installation minikube in Unix/Linux

Minikube implements a local Kubernetes cluster on MacOS or Linux OS. The main objectives minikube — become the best tool for developing local applications Kubernetes and to maintain all appropriate functions Kubernetes.

Installation on MacOS minikube

To check whether it supports virtualization in your macOS, run the following command on your terminal:

$ sysctl -a | grep -E --color'. allowaperture cpu.features|VMX'

As you can see from my output — I have everything you need.

-=== METHOD 1 ===-

Installed homebrew, article here — to install homebrew

And then you can enter CANDU:

$ brew cask install minikube

-=== METHOD 2 ===-

You can also install it on macOS, downloading a particular binary file:

$ sudo curl -Lo /usr/local/bin/minikube 
 && sudo chmod +x /usr/local/bin/minikube

Check the version with:

$ minikube version
minikube version: v1.4.0
commit: 7969c25a98a018b94ea87d949350f3271e9d64b6

So here!

Setting minikube in Unix/Linux

To check whether it supports virtualization in Linux, run the following command and verify that the output is not empty:

$ grep -E --color 'vmx|svm' /proc/cpuinfo

Next is to install kubectl. Next, you should install hypervisor, for example kvm or virtualbox:

Install Virtualbox on Centos/Fedora

Install VirtualBox on Ubuntu/Debian or Linux Mint

Installing the KVM hypervisor on Debian/Ubuntu

For example, you can install KVM to install this package:

$ sudo apt install cpu-checker && sudo kvm-ok

If you run kvm-ok you get the following output, you can use KVM on your computer (otherwise, check your configuration):

$ sudo kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used

Now, let’s install KVM and libvirt and add our current user to the group libvirt to provide sufficient permissions:

$ sudo apt install libvirt-clients libvirt-daemon-system qemu-kvm 
 && sudo usermod -a-G libvirt $(whoami) 
 && newgrp libvirt

After you install libvirt, you can check the validity of the host for running virtual machines using the tool virt-host-validate, which is part of libvirt:

$ sudo virt-host-validate

Put kubectl:

$ curl -LO$(curl -s 
 && sudo install kubectl /usr/local/bin && rm kubectl

If KVM is used as the only driver for Minikube on our machine, it is more convenient to set it as the default driver, and run Minikube with fewer command-line arguments. The following command installs the driver KVM default:

$ minikube config set vm-driver kvm2

If you don’t install using the package, you can load a single binary file and use it:

$ curl -Lo minikube 
 && chmod +x minikube

Here is a simple way to add an executable Minikube to your path:

$ sudo mkdir -p /usr/local/bin/ && 
install minikube /usr/local/bin/

You can check the version of the utility:

$ minikube version

Installation is completed.

Working with minikube in Unix/Linux

Start very simple:

$ minikube start

But you can specify the number of cores and how much RAM to allocate minicube:

$ minikube start 6 --cpus --memory 8192
😄 minikube v1.2.0 on darwin (amd64)
👍 minikube will upgrade the local Kubernetes cluster from 1.10.0 to 1.15.0
💿 Downloading Minikube ISO ...
 129.33 MB / 129.33 MB [============================================] 100.00% 0s
💡 Tip: Use 'minikube start-p <name>' to create a new cluster, or 'minikube delete' to delete this one.
🔄 Restarting an existing virtualbox VM for "minikube" ...
⌛ Waiting for SSH access ...
🐳 Configuring environment for Kubernetes v1.15.0 on Docker 17.12.1-ce
💾 Kubeadm Downloading v1.15.0
💾 Kubelet Downloading v1.15.0
🚜 Pulling images ...
🔄 Relaunching Kubernetes v1.15.0 using kubeadm ...
⌛ Verifying: apiserver etcd proxy scheduler controller dns
🏄 Done! kubectl is now configured to use "minikube"

PS: the Launch was made on Makos, and as gipervizor was chose virtualbox.

You can get the following error:

machine does not exist


$ minikube delete && minikube start

To check the status, run:

$ minikube status

If there is a need to delete a stack, run:

$ minikube delete
🔥 Deleting "minikube" in virtualbox ...
💔 The "minikube" cluster has been deleted.

To help performed:

$ minikube --help
Minikube is a CLI tool that provisions and manages single-node Kubernetes clusters optimized for development workflows.

Basic Commands:
 start Starts a local kubernetes cluster
 status Gets the status of a local kubernetes cluster
 stop Stops a running local kubernetes cluster
 delete Deletes a local kubernetes cluster
 dashboard Access the dashboard kubernetes running within the cluster minikube

Images Commands:
 docker-env Sets up the docker env variables; similar to '$(docker-machine env)'
 cache Add or delete an image from the local cache.

Configuration and Management Commands:
 addons Modify minikube''s kubernetes addons
 config Modify config minikube
 profile Profile gets or sets the current minikube profile
 update-context Verify the IP address of the running cluster in kubeconfig.

Networking and Connectivity Commands:
 kubernetes service Gets the URL(s) for the specified service in your local cluster
 tunnel tunnel makes services of the type LoadBalancer accessible on localhost

Advanced Commands:
 mount Mounts the specified directory into minikube
 ssh Log into or run a command on a machine with SSH; similar to 'docker-machine ssh'
 kubectl Run kubectl

Troubleshooting Commands:
 ssh-key to Retrieve the ssh identity key path of the specified cluster
 the ip Retrieves the IP address of the running cluster
 logs Gets the logs of the running instance, used for debugging minikube, not user code.
 update-check Print current and latest version number
 version Print the version of minikube

Other Commands:
 Outputs minikube completion shell completion for the given shell (bash or zsh)

Use "minikube <command> --help" for more information about a given command.

Or specifically for some of the team:

$ minikube start --help
Starts a local kubernetes cluster

 --apiserver-ips=[]: A set of apiserver IP Addresses which are used in the generated certificate for kubernetes.
This can be used if you want to make the apiserver available from outside the machine
 --apiserver-name='minikubeCA': The apiserver name which is used in the generated certificate for kubernetes. This
can be used if you want to make the apiserver available from outside the machine
 --apiserver-names=[]: A set of apiserver names which are used in the generated certificate for kubernetes. This
can be used if you want to make the apiserver available from outside the machine
 --apiserver-port=8443: The apiserver listening port
 --cache-images=true: If true, cache the docker images for the current bootstrapper and load them into the machine.
Always false with --vm-driver=none.
 --container-runtime='docker': The runtime container to be used (docker, crio, containerd).
 --cpus=2, the Number of CPUs allocated to the VM minikube.
 --cri-socket=": The cri socket path to be used.
 --disable-driver-mounts=false: Disables the filesystem mounts provided by the hypervisors
 --disk-size='20000mb': Disk size allocated to the VM minikube (format: <number>[<unit>], where unit = b, k, m or
 --dns-domain='cluster.local': The cluster dns domain name used in the kubernetes cluster
 --dns-proxy=false: Enable the NAT DNS proxy for requests (virtualbox driver only)
 --docker-env=[]: Environment variables to pass to the Docker daemon. (format: key=value)
 --docker-opt=[]: Specify arbitrary flags to pass to the Docker daemon. (format: key=value)
 --download-only=false: If true, only download and cache files for later use - don't install or start anything.
 --embed-certs=false: if true, will embed the certs in kubeconfig.
 --enable-default-cni=false: Enable the default CNI plugin (/etc/cni/net.d/k8s.conf). Used in conjunction with
 --extra-config=: A set of key=value pairs that describe a configuration that may be passed to different components.
 The key should be '.' separated, and the first part before the dot is the component to apply the configuration to.
 Valid components are: kubelet, kubeadm, apiserver, controller-manager, etcd, proxy, scheduler
 Valid kubeadm parameters: ignore-preflight-errors, dry-run, kubeconfig, kubeconfig-dir node-name, cri-socket,
experimental-upload-certs, certificate-key, rootfs, pod-network-cidr
 --feature-gates=": A set of key=value pairs that describe the feature gates for alpha/experimental features.
 --force=false: Force minikube to perform possibly dangerous operations
 --host-dns-resolver=true: Enable host resolver DNS requests for NAT (virtualbox driver only)
 --host-only-cidr='': The CIDR to be used for the minikube VM (virtualbox driver only)
 --hyperkit-vpnkit-sock=": Location of the VPNKit socket used for networking. If empty, disables Hyperkit
VPNKitSock, if 'auto' uses Docker for Mac VPNKit connection, otherwise uses the specified VSock (hyperkit driver only)
 --hyperkit-vsock-ports=[]: VSock guest List of ports that should be exposed as sockets on the host (hyperkit
driver only)
 --hyperv-virtual-switch=": The hyperv virtual switch name. Defaults to first found. (hyperv driver only)
 --image-mirror-country=" Country code of the mirror image to be used. Leave empty to use the global one. For
Chinese mainland users, set it to cn.
 --image-repository=": Alternative image repository to pull docker images from. This can be used when you have
limited access to Set it to "auto" to let minikube decide one for you. For Chinese mainland users, you may use
local mirrors such as
 --insecure-registry=[]: Insecure Docker registries to pass to the Docker daemon. The default service CIDR range
will automatically be added.
 --interactive=true: Allow user prompts for more information
 --iso-url='': Location of the minikube iso.
 --keep-context=false: This will keep the existing kubectl context and will create a minikube context.
 --kubernetes-version='v1.16.0': The kubernetes version minikube that the VM will use (ex: v1.2.3)
 --kvm-gpu=false: Enable experimental NVIDIA GPU support in minikube
 --kvm-hidden=false: Hide the hypervisor from the guest signature in minikube (kvm2 driver only)
 --kvm network='default': The KVM network name. (kvm2 driver only)
 --kvm-qemu-uri='qemu:///system': The KVM QEMU connection URI. (kvm2 driver only)
 --memory='2000mb': Amount of RAM allocated to the VM minikube (format: <number>[<unit>], where unit = b, k, m or
 --mount=false: This will start the mount daemon and automatically mount files into minikube.
 --mount-string='/Users:/minikube-host': The argument to pass the minikube mount command on start.
 --native-ssh=true: Use native Golang SSH client (default true). Set to 'false' to use the command line 'ssh'
command when accessing the docker machine. The machine Useful for drivers when they will not start with 'Waiting for
 --network-plugin=": The name of The network plugin.
 --nfs-share=[]: Local folders to share with the Guest via NFS mounts (hyperkit driver only)
 --nfs-shares-root='/nfsshares': Where to root the NFS Shares, defaults to /nfsshares (hyperkit driver only)
 --no-vtx-check=false Disable checking for the availability of hardware virtualization before the vm is started
(virtualbox driver only)
 --registry-mirror=[]: Registry mirrors to pass to the Docker daemon
 --service-cluster-ip-range='': The CIDR to be used for cluster service IPs.
 --uuid=": Provide VM UUID to restore MAC address (hyperkit driver only)
 --vm-driver=": Driver is one of: [virtualbox parallels vmware vmwarefusion hyperkit] (defaults to virtualbox)
 --wait=true: Wait until Kubernetes core services are healthy before exiting.
 --wait-timeout=6m0s: max time to wait per Kubernetes core services to be healthy.

 minikube start [flags] [options]

Use "minikube start options" for a list of global command-line options (applies to all commands).

In this utility, there is nothing complicated to understand how to work with it. For our purposes, I use the start, stop, and removal of the stack. If there are thoughts that complement the article — be sure to add.

Let’s check if the cluster Kubernetes:

$ kubectl get nodes

Now let’s run a simple example application (in our case nginx):

$ kubectl create deployment nginx --image=nginx

Let us also check whether the configured pods in Kubernetes:

$ kubectl get pods

That’s all, “Install minikube in Unix/Linux” is completed.


(Visited 27 times, 1 visits today)