helm's dry-run mode to render yaml files without applying them

kubernetes helm yaml dry-run helm chart

2 min read | by Jordi Prats

When you are installing or upgrading a helm chart sometimes feels like an act of faith: You don't really know what it's going to actually deploy. With the --dry-run option

We can add the --dry-run option to the install and upgrade commands so we can get the yaml files that it's going to render and apply to the kubernetes cluster, but without actually applying them. This is how it's going to look like:

$ helm upgrade pet2cattle -f pet2cattle_values.yaml . --dry-run Release "pet2cattle" has been upgraded. Happy Helming! NAME: pet2cattle LAST DEPLOYED: Wed Dec 30 10:58:42 2020 NAMESPACE: kube-system STATUS: pending-upgrade REVISION: 59 TEST SUITE: None HOOKS: MANIFEST: --- # Source: pet2cattle/charts/minio/templates/post-install-prometheus-metrics-serviceaccount.yaml apiVersion: v1 kind: ServiceAccount metadata:  name: pet2cattle-minio-update-prometheus-secret  labels:  app: minio-update-prometheus-secret  chart: minio-8.0.8  release: pet2cattle  heritage: Helm --- (...) --- # Source: pet2cattle/templates/22-ingress_https.yaml apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata:  name: pet2cattle-https  labels:  helm.sh/chart: pet2cattle-1  app.kubernetes.io/name: pet2cattle  app.kubernetes.io/instance: pet2cattle  app.kubernetes.io/version: "2.6"  app.kubernetes.io/managed-by: Helm  annotations:  cert-manager.io/cluster-issuer: letsencrypt  traefik.ingress.kubernetes.io/router.tls: "true" spec:  tls:  - hosts:  - "pet2cattle.com"  secretName: k3s-p2c  rules:  - host: "pet2cattle.com"  http:  paths:  - backend:  serviceName: pet2cattle  servicePort: 8000  - host: "pet2cattle.com"  http:  paths:  - backend:  serviceName: pet2cattle  servicePort: 8000 NOTES: 1. Get the application URL by running these commands: 

As you can see there is some other data that it's also rendered, so it's not something we can just pipe directly to kubectl diff but with some grep-ing we work it out


Posted on 08/01/2021

Categories