Skip to main content
In this lesson you’ll see how a single detailed prompt to Claude Code For Beginners can generate and execute an idempotent Bash script that:
  • Installs prerequisites on an Ubuntu VM,
  • Configures kernel settings and systemd services,
  • Installs Docker, kubectl (from pkgs.k8s.io), and Minikube,
  • Starts a multi-node Minikube Kubernetes cluster (Docker driver),
  • Enables add-ons (metrics-server, ingress, dashboard),
  • Deploys an nginx demo application and prints access information.
A presentation slide titled "Creating Kubernetes Clusters with Claude" with a large "Demo" label on a dark curved background. A small "© Copyright KodeKloud" appears in the bottom corner.
Estimated time: ~15–30 minutes (depending on downloads and VM resources)
Difficulty: Intermediate
Environment and prerequisites 1 — Install Claude Code on the VM Install the Claude Code CLI on the machine where you plan to run this automation. For the KodeKloud course use the provided installer:
After installing, launch the Claude Code CLI and follow the interactive sign-in. You may be asked to open a browser to paste an authorization code. Example abbreviated output:
Once signed in you’ll see the Claude Code prompt similar to:
2 — Provide a detailed prompt (the setup guide) We provided Claude Code a comprehensive prompt called “Minikube Kubernetes Demo Setup Guide” describing:
  • Prerequisites and system-level configuration (sysctls, modules),
  • Packages to install (Docker, kubectl, Minikube),
  • Cluster profile (name, node count, CPU, memory),
  • Add-ons to enable (metrics-server, ingress, dashboard),
  • Demo application to deploy (nginx “hello” deployment),
  • Verification steps and fallbacks (port-forward).
Claude Code used that prompt to generate a single idempotent Bash script that performs the entire setup. The script below is the consolidated output saved as /tmp/minikube-demo.sh. 3 — The generated installation script Save the following to /tmp/minikube-demo.sh. The script is written to be idempotent: it checks for existing installs and skips re-installation where appropriate.
Make the script executable and run it:
4 — Handling Docker group and add-ons When the installer adds your user to the docker group, the membership may not take effect until you start a new login shell. The generated script attempts to enable add-ons inside a newgrp docker subshell to avoid permission errors. If an add-on fails due to permissions, re-run the add-on commands after obtaining docker group privileges:
If you do not start a new shell or run newgrp docker, Minikube or addon commands may fail with permission errors. Log out and log back in, or use newgrp docker, before re-running addon commands.
5 — Test the demo application (port-forward) Quick port-forward test from the VM:
Alternatively, use the Minikube-provided service URL printed by the script:
6 — Expected result summary After the script runs successfully you should see: Example verification console snippets you may see:
and
Notes and tips
Running the full three-node demo on a single VM requires sufficient host resources. If you have limited RAM/CPU, reduce NODES or MEM in the script (for example, use 1 node or 2GB per node) to test locally. Also consider using fewer add-ons while troubleshooting.
Quick checklist (sanity checks)
  • Ensure the VM has enough RAM and CPUs for the configured node count.
  • Confirm internet connectivity for package and image downloads.
  • If kubectl or minikube fail unexpectedly, inspect logs and retry after ensuring docker group membership is active.
Links and references This lesson demonstrates how a single clear, structured prompt to Claude Code can produce an automated, idempotent script that reduces manual setup time for local Kubernetes testing with Minikube.

Watch Video