The best way to get on your legs with any software application is to jump right in. This is easier said than done with a large, powerful and complex application like Kubernetes, the software that supports modern container-based application deployments at scale. How does one get a handle on Kubernetes without setting up a full hardware suite?

You can start small with Minikube. Minikube is an embodiment of Kubernetes, fully API compatible with the Big Brother version, but designed to run on local devices – the developer’s desktop or laptop. It works across platforms (Linux, Mac and Windows), supports all Kubernetes container runtimes, and can be extended to add more advanced Kubernetes functionality.

Please note: This article assumes that you already understand the basics of Kubernetes and have worked with it to some extent. If you are looking for a basic Kubernetes tutorial, you will find some good options here.

Minikube requirements

Minikube runs on all three major operating systems (although at this point only on x86-64 machines), and requires a system with an Internet connection and the following specifications:

  • At least two CPUs (for example, a processor with two or more hardware threads). Hardware-supported virtualization is not required but it is useful.
  • 2 GB of free memory – That’s 2 GB of RAM that you can provide in excess of the system’s normal workload requirements.
  • 20 GB of disk space.

You will also need a container or a virtual device manager, which may vary depending on the platform you’re running:

  • Any platform that supports Docker can use it as a container system. (You can also use Docker alternative Bodman.)
  • Parallels, VirtualBox, VMware Fusion, or VMware Workstation will also work on any platform that supports them, although these apps come with additional resources and licensing requirements.
  • On macOS, HyperKit supported.
  • On Windows, you can use Hyper-V.

If you plan to run Minikube on a system that has no internet connection, or only intermittent access, This is possible, but you may need to set up a local container registry to pull images from.

Install Minikube

Depending on the operating system you are using, you will need to follow different steps to install Minikube.

linux

The easiest way to install Minikube on Linux is to install its public binary, which should work in any shared distribution:

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube

Mac

macOS users can use an installation method very similar to Linux users:

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-darwin-amd64
sudo install minikube-darwin-amd64 /usr/local/bin/minikube

Homebrew users can use files brew install minikube.

windows

On Windows, one can use the following PowerShell script (as per Minikube docs) to install Minikube. Make sure to run it as an administrator. Note that the directory shown in the script is a temporary installation directory; Minikube does not live in this directory.

The second line of the script ensures that the target directory is in the system PATH; You may need to modify the script if you want to change the temporary installation directory.

New-Item -Path 'c:' -Name 'minikube' -ItemType Directory -Force
Invoke-WebRequest -OutFile 'c:minikubeminikube.exe' -Uri 'https://github.com/kubernetes/minikube/releases/latest/download/minikube-windows-amd64.exe' -UseBasicParsing

$oldPath = [Environment]::GetEnvironmentVariable('Path', [EnvironmentVariableTarget]::Machine)
if ($oldPath.Split(';') -inotcontains 'C:minikube'){ `
  [Environment]::SetEnvironmentVariable('Path', $('{0};C:minikube' -f $oldPath), [EnvironmentVariableTarget]::Machine) `
}

Use virtualization with Minikube

One does not need to use virtualization to run containers, but it can ease the way. The first step is to make sure that hardware-assisted virtualization is enabled in your device’s BIOS.

Sometimes it can be difficult to locate this option. For example, on some systems, such as those using a motherboard designed primarily for gaming, the option to control hardware virtualization in the firmware will be in the BIOS section dedicated to overclocking options. Furthermore, the Virtualization option may not be visible by default, but only after enabling visibility for expert level controls.

If you are using virtualization, it is better to use the option in Minikube that is more original for your operating system. On Windows, this would be Hyper-V; On macOS, HyperKit. On Linux, native containers are ideal, which makes virtualization completely optional, although you may have your own reasons for using them (eg, for improved isolation).

Minikube Driver Setup

Minikube interacts with the system container or hypervisor system via a driver. the Available drivers It varies by operating system, but you can use Docker as a secure default on all popular platforms.

To set a driver to be used as the default, run the command

minikube config set driver <driver_type>

where <driver_type> It is one of a number of possible options. These are the most common (and should be self-explanatory):

Other drivers are available depending on the platform and software a person has installed:

  • virtualbox VirtualBox is used as a VM provider. This is a useful option on Windows if you are unable to use Hyper-V (for example, if you are running Windows Home). Note that Minikube will not install VirtualBox; You have to set it up yourself.
  • podman – that Alternate container runtime To Docker which uses a phishing-free architecture and does not require root privileges. Note that this engine is still considered experimental and should not be used in production.
  • vmware Driver for all VMware-based hypervisors. (Actual VMware installation is your responsibility.)
  • hyperkit Open source hypervisor driver for macOS. This is installed with Docker Desktop, so if you are already using Docker, you may not need to use this.
  • parallels Parallels Desktop Driver for Mac, which does not require VT-x hardware support.
  • ssh – Allows you to run on a user-provided virtual machine ssh. Note that when running minkube start, you have to pass the address of the virtual machine using the command line key, for example, --ssh-ip-address=vm.machine.com.
  • none – use metal driver, usually on Linux. For advanced or trial use only.

You can also provide a driver with a command line key when you start Minikube:

minikube start --driver=docker

This is useful if you need to switch drivers temporarily to test something. For the most part, though, you’ll want to assign a driver to be used full-time as part of your standard workflow.

Start Minikube

After installing Minikube and configuring its default driver, you can start the kit by typing minikube start. The startup process may take some time, as Minikube may need to fetch and configure images.

You can then use files kubectl To work with Minikube just as you do with Kubernetes.

Note that instead of writing kubectl only you You may need to prefix it with minikube and use -- Toggle to pass parameters along. For example, instead of kubectl create deployment (In addition to other options for posting), you can type minikube kubectl -- create deployment.

Minikube tries to stay up to date with the latest version of Kubernetes. If you need to work with a previous version, you can do so by selecting a version with an extension start ordering:

minikube start --kubernetes-version=v1.16.0

Minikube dashboard

Minikube comes with a web-based dashboard that provides a complete view of the cluster: workloads, services, configuration information, cluster data, custom resource definitions, and much more.

To open the dashboard in the default browser, simply type minikube dashboard in the command line. Note that if you close the command session where you ran the dashboard, the dashboard will shutdown automatically, unless you run the dashboard as a separate process.

minikube dashboard IDG

The Minikube Dashboard provides an interactive, all-in-one view of your Kubernetes setup on your desktop.

Use Minikube instead of Docker Desktop

Due to changes in the license and costs of Docker Desktop, many developers are looking for alternatives. Minikube can act as a fair alternative to Docker Desktop without much extra work. Here’s how:

  1. If you already have Docker Desktop installed, remove it and reboot.
  2. Make sure you have the environment variable DOCKER_BUILDKIT set to 1. (This lets BuildKit for better performance during the build process.)
  3. Install Docker CLI – Not Docker Desktop or Docker daemon, just a command line tool. One way to do this is by using a package manager – for example, using Chocolatey on Windows.
  4. Run Minikube normally. If you want to create Docker images, you need to use Docker driver; If you only want to run containers, you can use a hypervisor or a VM.
  5. If you don’t plan to use Kubernetes (just run the containers as is without the formatting features), you can use minikube start --no-kubernetes As a command to start Minikube.
  6. He runs minikube docker-env (You may need to do this as an administrator) to create a list of instructions needed to configure Docker to use Minikube as a runtime host. These instructions vary by operating system.
  7. After following these instructions, the file docker You must use the Minikube command line tool as its host. You can check it by writing docker ps And see if you get a list of running containers.

Note that you will need to invoke the commands described by Minkube in Step 6 in order to Every driving session Where do you want to use Docker.

Copyright © 2021 IDG Communications, Inc.

Source link

Leave a Reply

Your email address will not be published.