A local KinD cluster for local testing helm charts and CI/CD. This is inspired by how SIG-Testing test kubernetes.
Install any missing dependencies on your system
From the root directory of this repo
make cluster
You'll get a 5 node cluster that runs inside Docker. Loadbalancers will work
inside this cluster. Modifications can be made by editing
conf/kind-config.yaml
. Consult KinD docs for ideas.
make clean
You can install prometheus and grafana using the metrics
target.
make metrics
Connect to grafana dashboard
Port-forward the grafana svc to your localhost.
kubectl port-forward svc/grafana 3000:80
Visit localhost:3000/ in your browser. Username/password is admin
:password
.
Auto import metric dashboards for your charts
grafana will import any configmap with the label grafana_dashboard=1
as a
dashboard. To utilize this, you can export the dashboard json and put into
the root directory of your helm chart. Then create the configmap as a File
import.
{{- if .Values.dashboard.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: sample-grafana-dashboard
labels:
grafana_dashboard: "1"
data:
k8s-dashboard.json: |-
{{ .Files.Get "dashboard.json" | indent 4 }}
{{- end }}
bitnami chart repo is a great pair for local KinD clusters. You can easily add on backend services. The following example installs a mongodb that can be used by your helm chart.
Enable bitnami repos
make helm-bitnami
install mongodb
helm install mongodb --set architecture="standalone" --set auth.enabled=false --set persistence.enabled=false bitnami/mongodb