如何在kubernetes中为一个选择器设置两个具有多个字段的字段
目前,我的一项服务中有以下配置:
spec:
clusterIP: None
ports:
- name: grpc
port: 9000
protocol: TCP
targetPort: 9000
selector:
app: my-first-app
environment: production
group: my-group
type: ClusterIP
在选择器部分,我需要添加另一个应用程序:
.
.
app: my-first-app my-second-app
.
.
我怎样才能做到这一点?
谢谢!
回答
selector:
matchExpressions:
- {key: app, operator: In, values: [my-first-app, my-second-app]}
参考:https : //kubernetes.io/docs/concepts/overview/working-with-objects/labels/