Kubernetes Practice

아래 자료들을 참고해 정리하였다. 특히 총 7강의 영상이 큰 도움이 되었다.

Install

k3s를 설치한다.

확인

kube config

기본 storage class가 없기때문에 Local path provisioner를 설치한다.

Set default

확인

kubectl

자주 사용하는 kubectl 명령어를 알아본다. 기본 명령어는 아래와 같다.

  • apply

    • Apply a configuration to a resource by filename or stdin

  • get

    • Display one or many resources

  • describe

    • Show details of a specific resource or group of resources

  • delete

    • Delete resources by filenames, stdin, resources and names, or by resources and label selector

  • logs

    • Print the logs for a container in a pod

  • exec

    • Execute a command in a container

get

describe

그 외 자주 사용하는 명령

Pod

빠른 예제

YAML 파일을 아래와 같이 만들 수 있다.

다음 명령을 통해 적용 및 삭제가 가능하다.

Pod ready 개념은 아래 그림을 통해 도식화 할 수 있다.

livenessProbe 예제 (살아 있는지 조사)

readinessProbe 예제 (준비가 되었는지 조사)

health check 예제

multi container 예제

다음 명령어로 정리한다.

Replicaset

개념은 다음과 같다.

ReplicaSet -> Find pod by labels -> Create pod from template

기본 예제

스케일 아웃 예제

정리

Deployment

Deployment using replicaset

기본 예제

추가 예제

정리

Service

StaticIP와 NodePort에 대해 실습한다.

기본 예제

노드 포트

정리

Last updated

Was this helpful?