Adding Volume on Deployment yaml file for HTTPS certificate #4578
-
Hi, How to add volume on yaml file for environment variables such as "ASPNETCORE_Kestrel__Certificates__Default__Path" and "ASPNETCORE_Kestrel__Certificates__Default__Password" ? This is the content of my environment variable on Deployment yaml file:
I think that adding a volume will solve my error which is, If there other ways to solve this, please let me know. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
You need to use a Kubernetes Secret to get the certificate into Kubernetes. See how its done for static files in this example: https://kubernetes.io/docs/concepts/configuration/secret/#use-case-pod-with-ssh-keys. Then the secret needs to be mounted using a volume mount. If you are working in Azure and have a KeyVault that contains your certificate, you can use Azure Key Vault Provider for Secrets Store CSI Driver. This also uses Kubernetes Secrets, but the secret is populated by the driver rather than you manually creating a static secret. |
Beta Was this translation helpful? Give feedback.
-
You can also consider terminating HTTPS at ingress level and not handling HTTPS/certificates in your application. For more information on that option see https://learn.microsoft.com/en-us/azure/aks/ingress-tls?tabs=azure-cli |
Beta Was this translation helpful? Give feedback.
-
Hi, It works by adding kubernetes secret and adding volume and volumeMounts on Deployment yaml file. Thank you everyone for helping! |
Beta Was this translation helpful? Give feedback.
You need to use a Kubernetes Secret to get the certificate into Kubernetes. See how its done for static files in this example: https://kubernetes.io/docs/concepts/configuration/secret/#use-case-pod-with-ssh-keys. Then the secret needs to be mounted using a volume mount.
If you are working in Azure and have a KeyVault that contains your certificate, you can use Azure Key Vault Provider for Secrets Store CSI Driver. This also uses Kubernetes Secrets, but the secret is populated by the driver rather than you manually creating a static secret.