mnubo / kubernetes-py

A python module for Kubernetes.
Apache License 2.0
123 stars 46 forks source link

请问如何增加 add_image_pull_secrets #139

Closed amoyx closed 6 years ago

amoyx commented 6 years ago

使用K8sDeployment时,不知道如何使用 add_image_pull_secrets, 由于拉取docker镜像时需要密钥。但是不知道如何使用add_image_pull_secrets

sebastienc commented 6 years ago

Hi,

I'm not sure Google Translate worked correctly, please correct in english if not.

You need to first create the appropriate secrets using K8sSecret. For example:

config = K8sConfig(kubeconfig=kubeconfig_fallback)

secret = K8sSecret(config=config,name='my-pull-secret')
data = {"auths": {"repo:port": {"auth": "authstring", "email": "you@company.com"}}}
secret.dockerconfigjson = data
s = secret.create()

deploy = K8sDeployment(config=config, name='my-deployment')
deploy.add_image_pull_secrets(secret={'name': 'my-pull-secret'})

Please let me know if this helps.

Regards,

Sebastien

amoyx commented 6 years ago

@sebastienc thks, perfect