본문 바로가기
SMALL

software engineering/k8s13

status Error인 pod 모두 삭제하기 awk, xargs 조합 외에 다른 방법이 있나 검색 잠깐 해봤는데 별 다른 방법이 없는 듯 kubectl get pods | grep Error | awk '{ print $1 }' | xargs kubectl delete pod 2021. 3. 31.
Helm - Developing Templates - Named Templates Named Templates partial 혹은 subtemplate이라고도 불리는데 이게 더 직관적인 듯. template name은 전역이라 중복이 되면 가장 나중에 로드된 것만 쓰이므로 조심. PARTIALS AND _ FILES NOTES.txt를 제외하고 templates/ 이하의 파일들은 k8s 파일로 간주됨. 그리도 _로 시작하는 파일도 k8s 파일로 간주되지 않음. 주로 chart subtemplates으로써의 helpers로 사용된다. DECLARING AND USING TEMPLATES WITH DEFINE AND TEMPLATE define action으로 template 정의 가능. 그리고 template action으로 사용한다. {{- define "mychart.labels" .. 2021. 2. 18.
Helm - Developing Templates - Variables Variables with function을 사용하면 .Release.Name 같은 Built-In Objects를 사용하지 못하게 되는데, 변수를 사용하여 이용할 수 있다. apiVersion: v1 kind: ConfigMap ... data: {{- $relname := .Release.Name -}} {{- with .Values.favorite }} food: {{ .food | upper | quote }} release: {{ $relname }} {{- end }} assignment operator는 := 을 사용하고 재할당할 때는 = 을 사용. 2021. 2. 18.
Helm - Developing Templates - Flow Control Flow Control 다음의 control structures를 제공 if / else : 조건부 blocks 생성 with : scope 정의 range : for each 스타일의 loop 그리고 named template를 선언하거나 사용할 때 사용하는 몇가지 actions가 있음 define : 새로운 named template 선언 template : named template 가져오기 block : ? IF/ELSE 일반적인 if else 문법의 그것. 단, 조건부가 false가 되는 조건이 조금 특별하다. a boolean false a numeric zero an empty string a nil (empty or null) an empty collection 한마디로 0을 포함해 emp.. 2021. 2. 17.