[CKA] Kubectl Command Tips

hope·2023년 10월 30일

CKA

목록 보기
2/8
post-thumbnail

명령어 팁

vim

~/.vimrc

set tabstop=2
set expandtab
set shiftwidth=2

Fast dry-run output

export do="--dry-run=client -o yaml"
k run pod1 --image=nginx $do

Fast pod delete

export now="--force --grace-period 0"
k delete pod1 $now

네임스페이스 개수 구하기

kubectl get ns --no-headers | wc -l

옵션 설명

  • no-headers: 헤더 없이 출력

  • default: 헤더 출력

  • wc: 리눅스 기본 명령어로, 줄, 단어, 문자, 바이트 수를 알려줌

    	-c, --bytes: 바이트(byte) 수
    	-m, --chars: 문자(char) 수
    	-l, --lines: 줄(line) 수
    	-L, --max-line-length: 가장 긴 줄의 길이
    	-w, --words: 단어(word) 수
profile
devops 엔지니어

0개의 댓글