I have been using Google Cloud Kubernetes Engine Containers to create Jobs.
When I use the Google Cloud UI Dashboard to connect to container and jobs, I am able to get the credentials and execute commands while having active authentication with the container credentials :
gcloud container clusters get-credentials cluster-1 --region us-central1 --project MYPROJECT
The command produces the logs below :
Fetching cluster endpoint and auth data.
kubeconfig entry generated for cluster-1.
I am using the following code to create a Job on the same container, and I want the credentials to propagate through cluster - container and finally to job as well.
security = client.V1SecurityContext(privileged=True, allow_privilege_escalation=True, capabilities= client.V1Capabilities(add=["CAP_SYS_ADMIN"]))
container = client.V1Container(name=container_name, command=["xvfb-run"], args=["-a", "\"/app/bin/Renderer\"", ">", "/app/bin/renderer.logs", "2"], image=container_image, env=env_list, security_context=security)
body.spec = client.V1JobSpec(backoff_limit=0, ttl_seconds_after_finished=600, template=template.template)
How shall I alter the python code to achieve the credentials and auth to work on the pod just as it works on the container ?