Skip to content

Instantly share code, notes, and snippets.

@hermanbanken
Last active January 2, 2020 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hermanbanken/e2bfafc454a47737170e09463a684deb to your computer and use it in GitHub Desktop.
Save hermanbanken/e2bfafc454a47737170e09463a684deb to your computer and use it in GitHub Desktop.
replica issue
kind: Deployment
# repro1.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo
namespace: default
spec:
replicas: 2
# in next apply we'll remove this replicas property
strategy: { "type": "RollingUpdate", "rollingUpdate": { "maxUnavailable": 1 } }
selector: { "matchLabels": { "app": "demo" } }
template:
metadata: { "labels": { "app": "demo" } }
spec:
containers:
- image: alpine
name: noop
command: ["sh -c 'while true; do sleep 1; done'"]
# repro2.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo
namespace: default
spec:
# replicas: 2 is now removed, it will default to 1 and overwrite the runtime value of 2
strategy: { "type": "RollingUpdate", "rollingUpdate": { "maxUnavailable": 1 } }
selector: { "matchLabels": { "app": "demo" } }
template:
metadata: { "labels": { "app": "demo" } }
spec:
containers:
- image: alpine
name: noop
command: ["sh -c 'while true; do sleep 1; done'"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment