You need to add selector in spec of Deployment.
And also, these selector should match with labels in PodTemplate.
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: moverick-mule-pre
spec:
replicas: 2
selector:
matchLabels:
app: moverick-mule-pre
commit: $CI_COMMIT_SHA
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
template:
metadata:
labels:
app: moverick-mule-pre
commit: $CI_COMMIT_SHA
Otherwise, you will get error like below
The Deployment “moverick-mule-pre” is invalid:
- spec.selector: Required value
- spec.template.metadata.labels: Invalid value: map[string]string{…}
selectordoes not match templatelabels