Google cloud kubernetes start docker container image with parameters such as --runtime=nvidia

9/17/2019

I want google cloud kubernetes to run my docker image with images. such as:

docker run -it --runtime=nvidia --volume path_to_data:/root/data my_image

How to configure these parameters?

-- lkhgvsuren
google-kubernetes-engine
kubernetes

1 Answer

9/17/2019

It depends on Registry visibility.

For public images such as nginx it's simple:

Just run:

kubectl run mynginx --image=nginx

There is good explanation: Running a Docker Container on Google Container Engine - YouTube

As for Private registry, there are many cases.

According to manual: Images - Kubernetes

Using a Private Registry

Private registries may require keys to read images from them. Credentials can be provided in several ways:

Using Google Container Registry

  • Per-cluster
  • automatically configured on Google Compute Engine or Google Kubernetes Engine
  • all pods can read the project’s private registry

Using Google Container Registry

Kubernetes has native support for the Google Container Registry (GCR), when running on Google Compute Engine (GCE). If you are running your cluster on GCE or Google Kubernetes Engine, simply use the full image name (e.g. gcr.io/my_project/image:tag).

All pods in a cluster will have read access to images in this registry.

The kubelet will authenticate to GCR using the instance’s Google service account. The service account on the instance will have a https://www.googleapis.com/auth/devstorage.read_only, so it can pull from the project’s GCR, but not push

So, to run image from gcr.io, you can

kubectl run myapp --image=gcr.io/my_project/image:tag
-- Yasen
Source: StackOverflow