Fail to add kubernetes labels to all services

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

Hey, can you please share the description of these services?

Sure, these are the output from kubectl describe

Name:              appname-elasticsearch
Namespace:         shop
Labels:            app=appname
                   component=elasticsearch
                   velo/project=appname
Annotations:       velo/managed: true
                   velo/project: appname
                   velo/step: elasticsearch
                   velo/tenant: cluster:k8s-dev
                   velo/updated: 20220519085504
                   velo/version: 2e759c58bfb4078db13e0d8a132706480c018599
Selector:          app=appname,component=elasticsearch
Type:              ClusterIP
IP Family Policy:  SingleStack
IP Families:       IPv4
IP:                172.16.25.227
IPs:               172.16.25.227
Port:              metrics  9114/TCP
TargetPort:        9114/TCP
Endpoints:         100.64.21.4:9114
Session Affinity:  None
Events:            <none>

---

Name:              appname-elasticsearch-es-default
Namespace:         shop
Labels:            common.k8s.elastic.co/type=elasticsearch
                   elasticsearch.k8s.elastic.co/cluster-name=appname-elasticsearch
                   elasticsearch.k8s.elastic.co/statefulset-name=appname-elasticsearch-es-default
Annotations:       <none>
Selector:          common.k8s.elastic.co/type=elasticsearch,elasticsearch.k8s.elastic.co/cluster-name=appname-elasticsearch,elasticsearch.k8s.elastic.co/statefulset-name=appname-elasticsearch-es-default
Type:              ClusterIP
IP Family Policy:  SingleStack
IP Families:       IPv4
IP:                None
IPs:               None
Port:              http  9200/TCP
TargetPort:        9200/TCP
Endpoints:         100.64.21.4:9200
Session Affinity:  None
Events:            <none>

---

Name:              appname-elasticsearch-es-http
Namespace:         shop
Labels:            app=appname
                   common.k8s.elastic.co/type=elasticsearch
                   component=elasticsearch
                   elasticsearch.k8s.elastic.co/cluster-name=appname-elasticsearch
                   owner=search
Annotations:       <none>
Selector:          common.k8s.elastic.co/type=elasticsearch,elasticsearch.k8s.elastic.co/cluster-name=appname-elasticsearch
Type:              ClusterIP
IP Family Policy:  SingleStack
IP Families:       IPv4
IP:                172.16.19.84
IPs:               172.16.19.84
Port:              http  9200/TCP
TargetPort:        9200/TCP
Endpoints:         100.64.21.4:9200
Session Affinity:  None
Events:            <none>

---

Name:              appname-elasticsearch-es-transport
Namespace:         shop
Labels:            app=appname
                   common.k8s.elastic.co/type=elasticsearch
                   component=elasticsearch
                   elasticsearch.k8s.elastic.co/cluster-name=appname-elasticsearch
                   owner=search
Annotations:       <none>
Selector:          common.k8s.elastic.co/type=elasticsearch,elasticsearch.k8s.elastic.co/cluster-name=appname-elasticsearch
Type:              ClusterIP
IP Family Policy:  SingleStack
IP Families:       IPv4
IP:                None
IPs:               None
Port:              tls-transport  9300/TCP
TargetPort:        9300/TCP
Endpoints:         100.64.21.4:9300
Session Affinity:  None
Events:            <none>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.