0.0
The project is in a healthy, maintained state
Configures a Kubernetes cluster from a Vagrantfile and provides Helm and Kustomize provisioners.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 13.0
~> 3.12
~> 1.75
~> 0.9
 Project Readme

vagrant-k8s

CI CodeQL Release RubyGems License Conventional Commits Renovate Total downloads

Vagrant plugin to drive a Kubernetes cluster from the host machine, with Helm and Kustomize provisioners.

See the French documentation for the same content in French.

Installation

vagrant plugin install vagrant-k8s

Cluster configuration

Vagrant.configure("2") do |config|
  config.k8s.kubeconfig = "config/kubeconfig.yaml" # relative to the Vagrantfile
  config.k8s.context    = "kind-dev"
  config.k8s.namespace  = "demo"
  config.k8s.kubectl    = "kubectl"               # optional
end

Leave kubeconfig at nil to use the usual Kubectl configuration (including KUBECONFIG).

Helm provisioner

config.vm.provision "nginx", type: "helm" do |helm|
  helm.release = "nginx"
  helm.chart = "ingress-nginx"
  helm.repo = "https://kubernetes.github.io/ingress-nginx"
  helm.version = "4.11.3"
  helm.namespace = "ingress-nginx"
  helm.create_namespace = true
  helm.values = ["k8s/ingress-values.yaml"]
  helm.set = { "controller.replicaCount" => 2 }
  helm.wait = true
  helm.atomic = true
  helm.timeout = "5m"
end

The provisioner runs helm upgrade --install against the context configured in config.k8s.

Kustomize provisioner

config.vm.provision "application", type: "kustomize" do |kustomize|
  kustomize.path = "k8s/overlays/dev"
  kustomize.namespace = "demo" # overrides config.k8s.namespace
  kustomize.server_side = true
  kustomize.prune = true
  kustomize.prune_selector = "app.kubernetes.io/managed-by=vagrant"
  kustomize.wait = true
end

It runs kubectl apply -k. With wait, it waits for pods to become ready for five minutes.

Requirements

kubectl is required on the host. Helm is required only for the Helm provisioner. Manifest and values file paths are relative to the Vagrantfile directory.