Skip to content

micarlise/playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Playground

A local KinD cluster for local testing helm charts and CI/CD. This is inspired by how SIG-Testing test kubernetes.

Setup

Install any missing dependencies on your system

Build a local cluster

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.

Clean up cluster

make clean

Adding metrics and dashboards

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.

grafana home page

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 }}

Backend services for your helm chart

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

About

A local cluster with metrics and loadbalancers

Resources

License

Stars

Watchers

Forks