Edit your YAML files and set the same key-value pairs in both selector.matchLabels
and metadata.labels
.
spec:
selector:
matchLabels: # <---- This
app: database
template:
metadata:
labels: # <---- This
io.kompose.service: database
- Why
selector
field is important?
The
selector
field defines how the Deployment finds which Pods to manage. In this case, you simply select a label that is defined in the Pod template (app: nginx). However, more sophisticated selection rules are possible, as long as the Pod template itself satisfies the rule.
Update:
One possible sample can be:
spec:
selector:
matchLabels:
app.kubernetes.io/name: database
template:
metadata:
labels:
app.kubernetes.io/name: database
- Visit recommended labels
Update2:
no matches for kind "Deployment" in version "extensions/v1beta1"
The apiVersion
for Deployment
object is now apps/v1.
apiVersion: apps/v1 # <-- update here.
kind: Deployment
... ... ...
有话要说