-
Notifications
You must be signed in to change notification settings - Fork 982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get secret for custom Spilo image? #546
Comments
Hm... can't you set |
@alexeyklyukin , tried to set it, but does not help. Anyway such option will not cover case if we use few registries. |
@okolesnykovvs did you also specify the service account you've attached your secrets to in the You can deal with multiple registries as well by creating multiple service accounts. It's also questionable whether one really need a single operator managing Postgres pods that run images from multiple private registries |
We would also like to set imagePullSecrets for use of a custom spilo. It's more convenient if postgres-operator can set it on the serviceaccount when it is deploying the serviceaccount and cluster, instead of the cluster creation stalling until we edit the service account in the target namespace. |
All right. I've been testing a bit, and for us using a custom pod_service_account_definition with the imagePullSecret set works and is good enough. Like @alexeyklyukin suggested. It's then added to the serviceaccount on creation. In the configmap: |
Thanks @knan-nrk for the tests. This answers the question. I'll have a look where to add this explanation to the docs. |
@alexeyklyukin |
The following worked for me:
|
I did that and nothing happened. What do I need to do after adding this to the config map? I even redeployed all the definitions and it still didn't wind up in the pods. (I added imagePullSecrets to the |
@tpo Have you tried it this way:
When you look closely, a ServiceAccount The ServiceAccount can be examined with
Otherwise you could patch the ServiceAccount in hindsight: |
@pieveee : I've tried setting:
however the StatefulSet won't receive the regcreds. Do I need to restart anything? I did restart the operator. ? I'm currently running postgres-operator:v1.8.1. |
@tpo Looks like the approach with kubectl -n NAMESPACE patch serviceaccount postgres-pod -p '{"imagePullSecrets": [{"name": "SECRET_NAME"}]}' |
That seems to be working, thanks a lot @pieveee !!! |
Hi Pieveee, I understand that there are two places need to be replaced by the actual value: NAMESPACE and "SECRET_NAME". Could you elaborate which actual value should replace "SECRET_NAME"? Is that the value inside $HOME/.docker/config.json, for example: I assume the actual value in "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" should replace "SECRET_NAME" in the kubectl command, is my understanding correct? |
This solution works for me. After you apply above changes, all you need to do is delete the postgres-pod service account and then restart the postgres-operator to allow it to recreate the postgres-pod service account. |
Right now it's possible to specify
docker_image
to use custom Spilo image, like documentation says:But we can't specify secret for the custom image. So when I configure like:
docker_image: private_registry/company/spilo-cdp-10:1.5-p35
it fails to fetch image from the private registry.
Looking into source code - https://github.com/zalando/postgres-operator/blob/master/pkg/util/config/config.go#L78
There is no option to specify secret too.
The text was updated successfully, but these errors were encountered: