Hi.
I'm in a process to add correct labels to all kubernetes resources we have, but I fail to do that for a specific service. I'm not sure if my configuration is missing something, or if it is just a leftover from a failed installation. Anyway, I want to add the labels app and owner.
❯ kubectl get svc -n shop --show-labels | grep elasticsearch
appname-elasticsearch ClusterIP 172.16.25.227 <none> 9114/TCP 125d app=appname,component=elasticsearch,velo/project=appname
appname-elasticsearch-es-default ClusterIP None <none> 9200/TCP 125d common.k8s.elastic.co/type=elasticsearch,elasticsearch.k8s.elastic.co/cluster-name=appname-elasticsearch,elasticsearch.k8s.elastic.co/statefulset-name=appname-elasticsearch-es-default
appname-elasticsearch-es-http ClusterIP 172.16.19.84 <none> 9200/TCP 125d app=appname,common.k8s.elastic.co/type=elasticsearch,component=elasticsearch,elasticsearch.k8s.elastic.co/cluster-name=appname-elasticsearch,owner=search
appname-elasticsearch-es-transport ClusterIP None <none> 9300/TCP 125d app=appname,common.k8s.elastic.co/type=elasticsearch,component=elasticsearch,elasticsearch.k8s.elastic.co/cluster-name=appname-elasticsearch,owner=search
appname-Elasticsearch-es-default does not have these tags, and I though it should have. My configuration looks like this:
---
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
labels:
app: appname
owner: search
component: elasticsearch
name: appname-elasticsearch
namespace: shop
spec:
transport:
service:
metadata:
labels:
app: appname
owner: search
component: elasticsearch
http:
tls:
selfSignedCertificate:
disabled: true
service:
metadata:
labels:
app: appname
owner: search
component: elasticsearch
version: 7.15.2
podDisruptionBudget:
spec:
minAvailable: 1
selector:
matchLabels:
app: appname
component: elasticsearch
updateStrategy:
changeBudget:
maxSurge: 0
maxUnavailable: 1
nodeSets:
- name: default
count: 3
config:
node.master: true
node.data: true
node.ingest: true
node.store.allow_mmap: true
xpack.security.authc.anonymous:
username: preauthenticated
roles: [superuser]
authz_exception: true
podTemplate:
metadata:
labels:
app: appname
owner: search
component: elasticsearch
spec:
nodeSelector:
node-pool-group: standard
tolerations:
- key: node-pool-group
operator: Equal
value: standard
effect: NoSchedule
serviceAccountName: appname-elasticsearch