kubectl set image error: arguments in resource/name form may not have more than one slash (kubernetes)

Viewed 6610

I want to deploy my project to the Kubernetes cluster. I want to deploy it by using command:

- kubectl set image deployment/$CLUSTER_NAME gcr.io/$PROJECT_ID/$DOCKER_REPOSITORY:latest

But here I get error :

enter image description here

3 Answers

It's a misleading error message.

Essentially instead of abcxyz/abcxyz:example you also need to specify the container name that the image should be assigned to so for example example=abcxyz/abcxyz:example.

It's quite complicated and misleading, I got to say. Public docs don't help much but the kubectl set image --help does.

The problem is that you might have MULTIPLE instances in the deployment. If you have only one you can do something like this (note that this works but it's not AS SPECIFIC as you might want):

# The part before = is the spec.template.spec.containers.name which is image's brother
kubectl set image deployments goliardiait-staging=gcr.io/goliardia-prod/goliardia-it-matrioska:2.12 --all

I'll update when I find what nails it. In your case:

kubectl set image deployment $CLUSTER_NAME=gcr.io/$PROJECT_ID/$DOCKER_REPOSITORY:latest --all
- kubectl set image deployment/$CLUSTER_NAME $INSTANSE_NAME=gcr.io/$PROJECT_ID/$DOCKER_REPOSITORY:latest

It is working with using command like this

Related