Kubernetes | Rolling Update on Replica Set

11/8/2017

I'm trying to perform a rolling update of the container image that my Federated Replica Set is using but I'm getting the following error:

When I run: kubectl rolling-update mywebapp -f mywebapp-v2.yaml

I get the error message: the server could not find the requested resource;

This is a brand new and clean install on Google Container Engine (GKE) so besides creating the Federated Cluster and deploying my first service nothing else has been done. I'm following the instructions from the Kubernetes Docs but no luck.

I've checked to make sure that I'm in the correct context and I've also created a new YAML file pointing to the new image and updated the metadata name. Am I missing something? The easy way for me to do this is to delete the replica set and then redeploy but then I'm cheating myself :). Any pointers would be appreciated

mywebappv2.yaml - new yaml file for rolling update

apiVersion: extensions/v1beta1
kind: ReplicaSet
metadata:
  name: mywebapp-v2
spec:
  replicas: 4
  template:
    metadata:
      labels:
        app: mywebapp
    spec:
      containers:
        - name: mywebapp
          image: gcr.io/xxxxxx/static-js:v2
          resources:
            requests:
              cpu: 100m
              memory: 100Mi
          ports:
            - containerPort: 80
              name: mywebapp

My original mywebapp.yaml file:

apiVersion: extensions/v1beta1
kind: ReplicaSet
metadata:
  name: mywebapp
spec:
  replicas: 4
  template:
    metadata:
      labels:
        app: mywebapp
    spec:
      containers:
        - name: mywebapp
          image: gcr.io/xxxxxx/static-js:v2
          resources:
            requests:
              cpu: 100m
              memory: 100Mi
          ports:
            - containerPort: 80
              name: mywebapp
-- RomeNYRR
google-kubernetes-engine
kubernetes

1 Answer

11/8/2017

Try kind: Deployment.

Most kubectl commands that support Replication Controllers also support ReplicaSets. One exception is the rolling-update command. If you want the rolling update functionality please consider using Deployments instead.

Also, the rolling-update command is imperative whereas Deployments are declarative, so we recommend using Deployments through the rollout command.

-- Replica Sets | Kubernetes

-- silverfox
Source: StackOverflow