Starting MiniKube

Starting Minikube

In this lesson, we’ll cover how to start Minikube on your machine, explore the basics of interacting with your local Kubernetes cluster, and introduce the Minikube dashboard. By the end of this lesson, you will have a running Minikube cluster and a basic understanding of how to work with it.

1. Initializing Your First Minikube Cluster

Starting Minikube is a straightforward process, but there are a few options you can customize to suit your environment.

Step 1: Open Your Terminal or Command Prompt

  • Depending on your operating system, use your preferred terminal (e.g., PowerShell, Command Prompt, Terminal on macOS/Linux).

Step 2: Start Minikube

  • To start Minikube, simply run the following command:

    minikube start
    • Explanation:

      • This command will create and start a local Kubernetes cluster using the default settings. Minikube will automatically detect and use the best virtualization driver available on your system (e.g., Hyper-V, Docker, VirtualBox).

    • Customizing Your Cluster:

      • If you need to customize the resources allocated to the Minikube VM (like CPU, memory), you can do so with additional flags:

      minikube start --cpus=4 --memory=8192 --disk-size=50g
      • This example allocates 4 CPU cores, 8GB of memory, and 50GB of disk space to the Minikube VM.

Step 3: Monitor the Start Process

  • As Minikube starts, you’ll see output in your terminal that indicates the status of the cluster creation process. This includes downloading Kubernetes components, setting up the VM or container, and configuring the cluster.

Step 4: Verify the Cluster is Running

  • After Minikube has started, verify that your cluster is running correctly by using the following command:

    kubectl get nodes
    • Expected Output:

      • You should see a single node listed as Ready, which indicates that your Minikube cluster is up and running.

2. Exploring the Minikube Dashboard

Minikube comes with a built-in Kubernetes dashboard, which provides a user-friendly interface for managing and monitoring your cluster.

Step 1: Launch the Dashboard

  • To access the dashboard, run:

    minikube dashboard
    • Explanation:

      • This command will open the Kubernetes dashboard in your default web browser. The dashboard allows you to view and manage resources like Pods, Deployments, and Services, giving you a visual overview of your cluster’s health and activity.

Step 2: Navigating the Dashboard

  • Once the dashboard opens, you can explore various sections:

    • Workloads: View and manage your Pods, Deployments, ReplicaSets, Jobs, and more.

    • Services: Manage your Services and Ingress to control how applications are exposed.

    • Config and Storage: Explore ConfigMaps, Secrets, and Persistent Volume Claims.

    • Cluster: Monitor your cluster’s nodes, namespaces, and events.

    • Metrics: View resource usage and performance metrics for different components.

Step 3: Using the Dashboard to Manage Resources

  • You can use the dashboard to deploy applications, scale deployments, and manage the state of your cluster. The dashboard is a powerful tool for those who prefer a graphical interface over the command line.

3. Basic Minikube Commands

Minikube offers several commands that allow you to manage your cluster effectively. Here are a few key commands:

1. Status:

  • Check the status of your Minikube cluster:

    minikube status
    • This command will display information about the cluster, including the status of the Kubernetes components and the underlying VM or container.

2. SSH into Minikube:

  • SSH into the Minikube VM for deeper debugging or exploration:

    minikube ssh
    • This command opens an SSH session directly into the Minikube node, allowing you to interact with the VM’s file system and running processes.

3. Managing Kubernetes Versions:

  • Start Minikube with a specific version of Kubernetes:

    minikube start --kubernetes-version=v1.22.0
    • This command allows you to test your applications against different Kubernetes versions.

4. Stopping and Pausing Minikube

When you’re done working with your cluster, you can stop or pause Minikube to free up system resources.

1. Stop Minikube:

  • To stop the Minikube cluster without deleting it:

    minikube stop
    • This command shuts down the Minikube VM or container but keeps all your configurations and data intact.

2. Pause Minikube:

  • To pause Minikube, effectively putting it into a sleep state:

    minikube pause
    • This is useful if you want to temporarily halt the cluster without fully stopping it.

3. Resume Minikube:

  • To resume a paused Minikube cluster:

    minikube unpause

5. Deleting Minikube

If you need to completely remove the Minikube cluster:

1. Delete Minikube:

  • To delete the entire Minikube cluster:

    minikube delete
    • This command removes the Minikube VM or container, including all your data and configurations.

Last updated