StatefulSet에서 hostname의 번호 정보 가져오기: ${HOSTNAME##*-}

2025. 2. 28. 08:39k8s

##*- removes everything up to and including the last dash (-).

yml

- name: KAFKA_BROKER_ID
  value: "$(echo ${HOSTNAME##*-})"

command

kubectl exec -it kafka-0 -- sh -c "echo \$HOSTNAME"

'k8s' 카테고리의 다른 글

StatefulSet에 동적으로 pvc 바인딩하기  (0) 2025.02.28
mount시 권한 처리  (0) 2025.02.28
image 내용 확인 하기  (0) 2025.02.26
statefulset 다시 시작  (0) 2025.02.26
Pod에 DNS 구성  (0) 2025.02.24