Minikube: Configuration

From OnnoWiki
Jump to navigation Jump to search

Sumber: https://minikube.sigs.k8s.io/docs/handbook/config/


Mengonfigurasi cluster Anda

Basic Configuration

Sebagian besar konfigurasi minikube dilakukan melalui interface flag. Untuk melihat flag mana yang mungkin untuk perintah mulai, jalankan:

minikube start --help

Konfigurasi Persistent

minikube memungkinkan pengguna untuk dapat menyimpan nilai default baru untuk digunakan di semua profil, menggunakan perintah minikube config. Ini dilakukan dengan memberikan nama properti, dan nilai properti. Misalnya, untuk terus mengonfigurasi minikube untuk menggunakan hyperkit:

minikube config set driver hyperkit

Anda bisa mendapatkan daftar lengkap field yang dapat dikonfigurasi menggunakan:

minikube config --help

Untuk mendapatkan daftar properti konfigurasi yang saat ini ditetapkan:

minikube config view

Konfigurasi Kubernetes

minikube memungkinkan pengguna untuk mengonfigurasi komponen Kubernetes dengan nilai sembarang. Untuk menggunakan fitur ini, kita dapat menggunakan flag --extra-config pada perintah minikube start. Flag ini diulangi, sehingga Anda dapat meneruskannya beberapa kali dengan beberapa nilai berbeda untuk mengatur beberapa opsi.


Selecting a Kubernetes version

By default, minikube installs the latest stable version of Kubernetes that was available at the time of the minikube release. You may select a different Kubernetes release by using the --kubernetes-version flag, for example:

minikube start --kubernetes-version=v1.11.10

minikube follows the Kubernetes Version and Version Skew Support Policy, so we guarantee support for the latest build for the last 3 minor Kubernetes releases. When practical, minikube aims to support older releases as well so that users can emulate legacy environments.

For up to date information on supported versions, see OldestKubernetesVersion and NewestKubernetesVersion in constants.go

Enabling feature gates Kubernetes alpha/experimental features can be enabled or disabled by the --feature-gates flag on the minikube start command. It takes a string of the form key=value where key is the component name and value is the status of it.

minikube start --feature-gates=EphemeralContainers=true

Modifying Kubernetes defaults The kubeadm bootstrapper can be configured by the --extra-config flag on the minikube start command. It takes a string of the form component.key=value where component is one of the strings

kubeadm kubelet apiserver controller-manager scheduler and key=value is a flag=value pair for the component being configured. For example,

minikube start --extra-config=apiserver.v=10 --extra-config=kubelet.max-pods=100

For instance, to allow Kubernetes to launch on an unsupported Docker release:

minikube start --extra-config=kubeadm.ignore-preflight-errors=SystemVerification

Runtime configuration The default container runtime in minikube varies. You can select one explicitly by using:

minikube start --container-runtime=docker

Options available are:

containerd cri-o docker See https://kubernetes.io/docs/setup/production-environment/container-runtimes/

Environment variables minikube supports passing environment variables instead of flags for every value listed in minikube config. This is done by passing an environment variable with the prefix MINIKUBE_.

For example the minikube start --iso-url="$ISO_URL" flag can also be set by setting the MINIKUBE_ISO_URL="$ISO_URL" environment variable.

Exclusive environment tunings Some features can only be accessed by minikube specific environment variables, here is a list of these features:

MINIKUBE_HOME - (string) sets the path for the .minikube directory that minikube uses for state/configuration. If you specify it to /path/to/somewhere and somewhere is not equal to .minikube, the final MINIKUBE_HOME will be /path/to/somewhere/.minikube. Defaults to ~/.minikube if unspecified. Please note: this is used only by minikube and does not affect anything related to Kubernetes tools such as kubectl.

MINIKUBE_IN_STYLE - (bool) manually sets whether or not emoji and colors should appear in minikube. Set to false or 0 to disable this feature, true or 1 to force it to be turned on.

CHANGE_MINIKUBE_NONE_USER - (bool) automatically change ownership of ~/.minikube to the value of $SUDO_USER

MINIKUBE_ENABLE_PROFILING - (int, 1 enables it) enables trace profiling to be generated for minikube

MINIKUBE_SUPPRESS_DOCKER_PERFORMANCE - (bool) suppresses Docker performance warnings when Docker is slow

Example: Disabling emoji Linux macOS Windows export MINIKUBE_IN_STYLE=false minikube start Making environment values persistent To make the exported variables persistent across reboots:

Linux and macOS: Add these declarations to ~/.bashrc or wherever your shells environment variables are stored. Windows: Either add these declarations to your ~\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 or run the following in a PowerShell terminal: [Environment]::SetEnvironmentVariable("key", "value", [EnvironmentVariableTarget]::User)

Referensi

Pranala Menarik