Thibault Deheurles
Thibault Deheurles

Reputation: 1259

k8s - Kubernetes - Service Update - Error

I'm trying to update a service using :

kubectl update service my-service \
    --patch='{ "apiVersion":"v1", "spec": { "selector": { "build":"2"} } }'

I receive the following Error : Error from server: service "\"apiVersion\":\"v1\"," not found

I have tried the following :


Maybe the kubectl update is not available for service ?


For now I was making my updates by simply stoping and restarting my service. But sometime, the corresponding forwarding-port changes. So it seems to not be the good choice ...


PS:

Upvotes: 1

Views: 972

Answers (1)

lavalamp
lavalamp

Reputation: 399

I am not sure if patch is 100% working yet, but if you are going to do this, you at least need to put apiVersion inside metadata, like so:

--patch='{ metadata:{ "apiVersion":"v1" }, "spec": { "selector": { "build":"2"} } }'

Upvotes: 1

Related Questions