You can absolutely pin Minikube to a specific Kubernetes version, and it’s the right move when you need predictable builds or want to test against exactly what you’ll see in production.

Here’s how you can run Minikube with Kubernetes version 1.28.2:

minikube start --kubernetes-version=v1.28.2

That’s it. Minikube will download the specified Kubernetes components and start your cluster using that exact version.

Why is this so useful? Imagine you’re developing a new feature for your application that relies on a specific Kubernetes API version that was deprecated in 1.29 but is fully supported in 1.28. If you let Minikube default to the latest version, your feature might break unexpectedly. By pinning, you ensure your development environment mirrors your production environment’s Kubernetes version, preventing those "it worked on my machine" headaches.

Let’s look at the underlying mechanics. When you run minikube start, it orchestrates the creation of a virtual machine (or container) that will host your Kubernetes control plane and nodes. The --kubernetes-version flag tells Minikube which set of Kubernetes binaries (like kube-apiserver, kube-controller-manager, kube-scheduler, and kubelet) to download and install within that environment. Minikube then configures these components to work together as a functional Kubernetes cluster.

It’s not just about the control plane. The version you specify also dictates the kubelet version running on your nodes, which is crucial for how Pods are managed and how nodes report their status. If your application deployment YAML uses specific features or resource definitions tied to a particular Kubernetes API version, pinning ensures those definitions are compatible with the cluster’s actual capabilities.

Consider a situation where you’re testing a complex deployment that uses Admission Controllers. Different Kubernetes versions might have different default Admission Controllers enabled, or their behavior might subtly change. Pinning to a specific version, say 1.27.5, allows you to precisely control this environment and ensure your tests are valid for that particular release.

apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
  name: my-validating-webhook
webhooks:
  - name: mywebhook.example.com
    clientConfig:
      service:
        name: my-webhook-service
        namespace: webhook-namespace
        path: "/validate"
      caBundle: "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURHekNDQWdnZ0F3SUJBZ0lVVjQvdkVqN1B5d2k1Rk9tV014V01yS1JzZ01rZ0JkQU5CZ2txaGtpRzl3MEJ

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-webhook-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: my-webhook
  template:
    metadata:
      labels:
        app: my-webhook
    spec:
      containers:
      - name: webhook
        image: my-webhook-image:latest
        ports:
        - containerPort: 8443

If you were to run this deployment definition on a cluster running Kubernetes 1.29 without pinning, and later on a 1.28.2 cluster, you might encounter subtle differences in how the webhook is registered or how the kubelet interacts with it, especially if the admissionregistration.k8s.io/v1 API had schema changes between those versions. Pinning to v1.28.2 ensures consistency.

The real power comes when you integrate this into your CI/CD pipeline. Instead of relying on whatever version of Kubernetes Minikube happens to provision by default, you explicitly state the target version. This makes your build and test jobs deterministic.

# In your CI script
MINIKUBE_K8S_VERSION="v1.28.2"
minikube delete --all --purge
minikube start --kubernetes-version=${MINIKUBE_K8S_VERSION}
# ... your kubectl commands for deploying and testing ...
minikube stop

This approach is also invaluable when you need to reproduce a bug that was reported on a specific Kubernetes version. You can spin up a Minikube cluster with that exact version and systematically debug the issue without worrying about environment drift.

It’s worth noting that Minikube caches Kubernetes versions it downloads. So, if you’ve started a cluster with v1.28.2 before, subsequent minikube start --kubernetes-version=v1.28.2 commands will be much faster as it won’t need to re-download the binaries.

Most people stop at just pinning the cluster version. What they often miss is that you can also pin the driver that Minikube uses to create the VM or container. For example, if you’re using the Docker driver and want to ensure your cluster runs with a specific Docker daemon version that’s known to be compatible with a certain Kubernetes release, you’d use:

minikube start --driver=docker --kubernetes-version=v1.28.2

This level of control ensures that not only the Kubernetes components but also the underlying infrastructure they run on are consistent, which is critical for deep troubleshooting or performance testing.

Once you have your Minikube cluster running with a specific version, the next logical step is often to explore how to manage add-ons within that constrained environment, ensuring they are also compatible with your chosen Kubernetes release.

Want structured learning?

Take the full Minikube course →