Hello,
My purpose is to assign secrets as key-value pairs as environment variables.
I checked the the example but it doesn’t work as explained; so I changed a bit.
Here is my config:
podAnnotations:
vault.hashicorp.com/ca-cert: "/run/secrets/kubernetes.io/serviceaccount/ca.crt"
vault.hashicorp.com/agent-inject: 'true'
vault.hashicorp.com/agent-inject-status: "update"
vault.hashicorp.com/role: 'myproject-microservices'
vault.hashicorp.com/agent-inject-secret-keycloak: 'kv/data/myproject/keycloak/access.env'
vault.hashicorp.com/agent-inject-template-keycloak: |
{{ with secret "kv/data/myproject/keycloak/access.env" -}}
export KEYCLOAK_MYPROJECT_ISSUERXXX="{{ index .Data.data "keycloak-myproject-issuer" }}"
{{- end }}
Hi @tirelibirefe, the environment variables will not show up when you run printenv in the container, because they’re only set for the entrypoint command (probably process 1). So to see what its environment variables are, exec into the container and take a look at /proc/1/environ:
k exec -n myproject $POD -c "$CONTAINER" -- cat /proc/1/environ
The output will be a little squished but that’ll tell you for sure what’s set.
And so that the container stays up to inspect it, you may want to do something like this for cmd and args:
The problem here is that you are randomly guessing various permutations of YAML and shell syntax which are incorrect.
Instead you should be more closely following the example you referenced. Taking into account what you have said about the existing entrypoint, I think you are going to need:
Sorry, I meant it not as a reprimand, but an explanation of part of why you’re finding it difficult to get useful answers from this forum.
This is a community help forum where people answering questions are doing so not for any financial reward, but just for the satisfaction of having helped someone.
The point being, the easier you make it for people to help you, the more likely you are to be helped.
You are currently doing two things which make it seem it will be very hard to provide help via a forum:
You’re making up lots of syntaxes, seemingly at random (you’re not saying why you’re trying these syntaxes).
When something doesn’t work, all you’re saying is “it didn’t work” - no details, no error messages, nothing that would provide insight into how and why it didn’t work.
Please remember that we cannot see your screen and we cannot read your mind - you need to tell us what you see on your screen and what you’re thinking, to make it possible to help you.