Skip to content

Minikube Introduction#

What Is The Minikube?#

  • Minikube is local Kubernetes, focusing on making it easy to learn and develop for Kubernetes.
  • Minikube quickly sets up a local Kubernetes cluster on macOS, Linux, and Windows.
  • What you’ll need
    • 2 CPUs or more
    • 2GB of free memory
    • 20GB of free disk space
    • Internet connection
    • Container or virtual machine manager, such as:  Docker, QEMU, Hyperkit, Hyper-V, KVM, Parallels, Podman, VirtualBox, or VMware Fusion/Workstation

Installing Minikube#

Minikube Commands#

  • After installing the Minikube, you can use two commands below to start MiniKube and the DashBoard for the Minikube.
1
2
minikube start
minikube dashboard

minikube-dashboard.png

  • You can find all commands of Minikube in the table below.
Command Description
minikube start Starts a local Kubernetes cluster.
minikube dashboard Opens the Kubernetes dashboard in your browser.
minikube status Displays the status of the local Kubernetes cluster.
minikube ip Displays the IP address of the local Kubernetes cluster.
minikube delete Deletes the local Kubernetes cluster.
minikube image load Loads a Docker image into the local Kubernetes cluster.
minikube service Creates a Kubernetes service for a Pod.
minikube profile list Lists all minikube profiles.
minikube profile use Switches to a minikube profile.
minikube help Displays help for a minikube command.
minikube addons list Lists all available addons.
minikube addons enable [addon] Enables an addon.
minikube addons disable [addon] Disables an addon.
minikube config Shows the minikube configuration.
minikube config set [key] [value] Sets a minikube configuration value.
minikube ssh Opens a shell to the minikube VM.
minikube ssh-key Prints the SSH key for the minikube VM.
minikube docker-env Prints environment variables for connecting to the Docker daemon inside minikube.
minikube podman-env Prints environment variables for connecting to the Podman daemon inside minikube.
minikube cp Copies a file or directory from your host machine to the minikube VM.
minikube mount Mounts a directory from your host machine to the minikube VM.
minikube logs Displays the logs for a Pod or container.
minikube pause Pauses the minikube cluster.
minikube unpause Unpauses the minikube cluster.
minikube tunnel Opens a tunnel to the Kubernetes API server.
minikube update-check Checks for updates to minikube.
minikube update-context Updates the kubectl context for minikube.
minikube version Displays the version of minikube.

Minikube Architecture#

  • As we knew in Kubernetes Introduction, to set up a Kubernetes production cluster, we would to prepare multiple master and worker nodes. It means we have to prepare several separated virtual or physical machines. So for learning or testing purpose on local it will take many efforts and resources.
  • Minikube is simpler it is basically one node cluster where the master processes and the work processes both run on one node and this node will have a docker container runtime pre-installed so we will be able to run the containers or the pods with containers on this node.

 #zoom

  • The way it is going to run on our machine is through a Container or virtual machine manager, such as: Docker, QEMU, Hyperkit, Hyper-V, KVM, Parallels, Podman, VirtualBox, or VMware Fusion/Workstation. So basically Minikube will create a container or a Virtual Machine environment on our machine and our node will run in that environment.
  • Overall, Minikube is a one node kubernetes cluster that runs in container or a Virtual Machine on our machine which we can use for testing kubernetes on our local.

Kubectl#

  • Kubectl is a command line tool for interacting with Kubernetes clusters. It is the primary interface through which administrators and developers can manage and control Kubernetes resources. Kubectl allows us to perform various operations on Kubernetes clusters, including deploying applications, inspecting and managing cluster resources, debugging applications, and more.

 #zoom

  • Please view Linux Setup For Developer for installing Kubectl on your Linux system.
  • Below is all commands of Kubectl which are grouped into tables.

Cluster Management#

Command Description
kubectl config Manage kubeconfig files and contexts.
kubectl cluster-info Display cluster information.

Resource Management#

Command Description
kubectl apply Apply configuration changes to cluster resources.
kubectl get Retrieve resource information.
kubectl describe View detailed resource information.
kubectl create Create a new resource.
kubectl delete Delete a resource.
kubectl edit Edit a resource's configuration.
kubectl exec Run a command inside a Pod.
kubectl logs View container logs.
kubectl port-forward Forward ports from a Pod to your local machine.
kubectl attach Attach to a running container.

Resource Inspection and Status#

Command Description
kubectl describe Describe resources in detail.
kubectl get events List events related to resources.
kubectl top Display resource usage statistics (e.g., CPU, memory).
kubectl rollout status Check the status of a rollout (e.g., for Deployments).
kubectl rollout history View rollout history.

Resource Scaling#

Command Description
kubectl scale Scale the number of replicas for a resource.
kubectl autoscale Configure horizontal pod autoscaling.

Resource Editing and Patching#

Command Description
kubectl edit Edit resource configurations.
kubectl patch Apply partial changes to a resource.
kubectl apply -f - Apply changes from stdin.

Resource Labeling#

Command Description
kubectl label Add or update labels on resources.
kubectl annotate Add or update annotations on resources.

Resource Port Forwarding#

Command Description
kubectl port-forward Forward ports from a Pod to your local machine.

Resource Deletion#

Command Description
kubectl delete Delete resources by name, label, or other criteria.
kubectl delete all Delete all resources in a namespace.

Resource Inspection and Debugging#

Command Description
kubectl get logs Fetch logs from a container.
kubectl describe pod Describe details of a Pod.
kubectl logs -f Stream container logs.

Resource Status Checking#

Command Description
kubectl get pods Check the status of Pods.
kubectl get services Check the status of Services.
kubectl get nodes Check the status of cluster nodes.
kubectl get pv/pvc Check the status of PersistentVolumes and PersistentVolumeClaims.

Resource Exporting and Importing#

Command Description
kubectl get -o json/yaml Export resource configurations.
kubectl apply -f Import resources from configuration files.

Resource Role-Based Access Control (RBAC)#

Command Description
kubectl auth Manage Role-Based Access Control (RBAC) settings.
kubectl auth can-i Check if a user or group has specific permissions.

Namespace Management#

Command Description
kubectl create namespace Create a new namespace.
kubectl delete namespace Delete a namespace and its resources.

Context and Configuration#

Command Description
kubectl config Manage kubeconfig files, contexts, and clusters.
kubectl config use-context Switch between contexts.
kubectl config current-context Display the current context.

Other Commands#

Command Description
kubectl version Display the client and server Kubernetes versions.
kubectl wait Wait for resources to reach a specific condition.

Debugging and Troubleshooting#

Command Description
kubectl debug Create a new Pod for debugging purposes.
kubectl trace Trace system calls in running containers.

See Also#

References#