minikube

repository·master·Indexed 12 days ago

https://github.com/kubernetes/minikube

A tool that runs a local Kubernetes cluster on macOS, Linux, and Windows, primarily intended for local Kubernetes application development. It includes support for various addons such as gVisor, KubeVirt, and registry-aliases, as well as performance testing tools like mkcmp and CPU usage benchmarks.

Tokens
128.4K
Snippets
569
Records
688
Agent score
99%

What's inside minikube

  1. What is minikube

    master
    minikube implements a local Kubernetes cluster on macOS, Linux, and Windows. It is designed to be a tool for local Kubernetes application development, supporting standard Kubernetes features such as LoadBalancers, NodePorts, Persistent Volumes, and various container runtimes.
  2. Overview of minikube capabilities

    master

    minikube is a tool for quickly setting up a local Kubernetes cluster on macOS, Linux, and Windows. It is designed primarily for application developers and new Kubernetes users.

    Key Capabilities:

    • Kubernetes Versions: Supports the latest release plus up to 6 previous minor versions.
    • Deployment Modes: Can be deployed as a Virtual Machine (VM), a container, or on bare-metal.
    • Container Runtimes: Supports multiple Container Runtime Interfaces (CRI) including CRI-O, containerd, and docker.
    • AI/GPU Support: Supports GPU acceleration for AI development via nvidia, amd, or apple drivers.
    • Advanced Networking & Storage: Supports LoadBalancer access, filesystem mounts, FeatureGates, and network policy.
    • Extensibility: Uses Addons to easily install common Kubernetes applications.
    • Developer Workflow: Provides a direct API endpoint for fast image loading and building.
  3. Supported container runtimes in minikube

    master

    minikube supports several container runtimes to satisfy Kubernetes requirements. When starting a cluster, you can choose from the following supported runtimes:

    • containerd
    • cri-o
    • docker

    Each runtime has specific configuration requirements and behaviors. Refer to the specific documentation for the runtime you intend to use to ensure proper setup.

  4. Access Kubernetes features in minikube

    master

    minikube provides specific commands to enable and access standard Kubernetes networking and management features:

    • LoadBalancer access: Use minikube tunnel to provide access to services of type LoadBalancer.
    • NodePort access: Use minikube service to access services of type NodePort.
    • Dashboard: Use minikube dashboard to launch the web-based Kubernetes user interface.
    • Multi-cluster support: Create and manage multiple independent clusters using the -p (profile) flag: minikube start -p <name>.
    • Container Runtimes: Specify a runtime during startup using the --container-runtime flag: minikube start --container-runtime <runtime>.
    # Example: Start a specific cluster profile
    minikube start -p my-cluster
    
    # Example: Access a LoadBalancer service
    minikube tunnel
    
    # Example: Open the dashboard
    minikube dashboard
  5. Difference between Initial and Iterative benchmark modes

    master

    Benchmarks are categorized into two modes to simulate different real-world container loading scenarios:

    Initial

    Simulates the very first time an image is loaded. To replicate a clean environment, all existing images and caches are cleared from both minikube and Docker between every run.

    Iterative

    Simulates a development workflow (similar to how Skaffold operates) where only the application code changes. In this mode, only the final layer (the Go binary) is updated, while the existing image and Docker cache are preserved between runs to measure the impact of incremental changes.

  6. Use custom registry domains for container images

    master

    Once the registry-aliases addon is configured, you can use the following domains as container registry URLs in your deployment manifests (e.g., skaffold.yaml or Kubernetes YAML files). These domains will resolve to the internal minikube registry:

    • example.com
    • example.org
    • test.com
    • test.org

    To test this locally with Docker, ensure your shell is using the minikube docker daemon context:

    eval $(minikube -p demo docker-env)
    eval $(minikube -p demo docker-env)
  7. Data loss warnings for the none driver

    master

    The none driver performs destructive operations on certain system paths:

    Overwritten on start:

    • /etc/kubernetes (configuration files)

    Erased on minikube delete:

    • /data/minikube
    • /etc/kubernetes/manifests
    • /var/lib/minikube

    Because Kubernetes has full access to your filesystem and docker images, unexpected data loss may occur.

  8. Benchmark script components and workflow

    master

    The CPU usage benchmark consists of three main components:

    • benchmark_local_k8s.sh: Executes the actual benchmark. It compares minikube drivers (e.g., hyperkit, virtualbox, docker with auto-pause addon, kvm2) against kind, k3d, and Docker for Mac Kubernetes (on macOS).
    • update_summary.sh: Aggregates results into a summary CSV file for each driver and product.
    • chart.go: Generates a bar chart graph as a PNG file from the results.

    Benchmark Workflow

    The benchmark_local_k8s.sh script follows these steps to compare auto-pause vs. non auto-pause states:

    1. Start the local Kubernetes tool.
    2. Deploy a sample Nginx application.
    3. Wait 1 minute for stability.
    4. Measure idle CPU usage using cstat (Initial state).
    5. For minikube only: Enable the auto-pause addon.
    6. For minikube only: Wait 1 minute for the control plane to transition to Paused status.
    7. For minikube only: Verify the control plane is indeed paused.
    8. For minikube only: Wait 3 minutes.
    9. For minikube only: Measure idle CPU usage using cstat (Auto-paused state).
  9. Understand how minikube reports test flake rates in PRs

    master

    To help distinguish between new regressions and existing flaky tests, minikube automatically comments on Pull Requests (PRs) when integration tests fail.

    When integration tests complete, a script named report_flakes.sh processes the gopogh summaries and the public gs://minikube-flake-rate/flake_rates.csv dataset. The resulting PR comment includes:

    • A list of all failed tests.
    • The recorded flake rate for each failed test.
    • Direct links to the flake charts for that specific test and environment.

    This allows developers and reviewers to quickly determine if a failure is a known unreliable test (a flake) or a potential new bug introduced by the PR.

  10. Understand the core goals and principles of minikube

    master

    minikube is designed to simplify running Kubernetes locally for day-to-day development workflows and learning. Its primary focus is providing a user-friendly, cross-platform, and reliable experience with minimal resource overhead and third-party dependencies.

    Key features that support these goals include:

    • Single command setup and teardown UX.
    • Support for local storage, networking, auto-scaling, and load balancing.
    • A unified UX across different operating systems.

    Note on Non-Goals: minikube is not intended to simplify Kubernetes production deployment experiences, nor does it aim to support every possible Kubernetes deployment configuration (such as all variations of storage or networking types).