k8s - Kubernetes - Service Update - Error

7/1/2015

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 :

  • moving the service name to the end
  • Removing the apiVersion

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:

  • v0.19
  • api_v1
-- Thibault Deheurles
kubernetes
service

1 Answer

7/7/2015

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"} } }'

-- lavalamp
Source: StackOverflow