[CKAD] 1일차
- advanced/Devops
- 2022. 9. 15.
주말에 시험을 봐서, CKA 자격증을 취득했습니다.
하지만 개발자 관점에서도 배포 전략, helm 등 배울 것이 더 남았다고 생각되어서
기왕 CKA를 딴김에 CKAD도 취득하고자 했습니다.
command and args
docker에서는 만약에 명령어를 준다면 다음과 같이 할 수 있습니다.
FROM Ubuntu
ENTRYPOINT ["sleep"]
CMD ["5"]
docker run ubuntu-sleeper 10
docker run ubuntu-sleeper 5
kubernetes에서는
spec:
containers:
- name: ubuntu-sleeper
image: ubuntu-sleeper
command: ["sleep"]
args: ["10"]
kubernetes security context
이 securityContext를 spec 밑에 둘 수도 있고 container 레벨에 둘 수도 있음
spec:
securityContext:
runAsUser: 1000
Readiness Probes
- Pod Conditions
PodScheduled: True/False 노드에 스케쥴링 되면 True
Initialized: True/False
ContainersReady: Pod의 모든 container가 ready이면 True
Ready: 위 세가지 조건이 충족되면 True
기본으로는 Pod은 컨테이너가 뜨기만 하면 Ready 상태로 봄
Readiness Probes는
HTTP 서버의 경우 /api/ready로 request를 보내서 response가 돌아올 경우
DB의 경우 TCP Test를 할 수 있는 경우
스크립트의 경우 Exec Command를 보내서 exit이 되었을 경우
apiVersion: v1
kind: Pod
metadata:
name: simple-webapp
labels:
name: simple-webapp
spec:
containers:
- name: simple-webapp
image: simple-webapp
ports:
- containerPort: 8080
readinessProbe:
httpGet:
path: /api/ready
port: 8080
readinessProbe:
httpGet:
path: /api/ready
port: 8080
readinessProbe:
tcpSocket:
port: 3306
readinessProbe:
exec:
command:
- cat
- /app/is_ready
추가적으로 readinessProbe에 아래 값을 설정할 수 있음
initialDelaySeconds: 10
periodSeconds: 5
failureThreashold: 8
LivenessProbe
livenessProbe:
httpGet:
path: /api/healthy
port: 8080
initialDelaySeconds: 10
periodSeconds: 5
failureThreshold: 8
livenessProbe:
tcpSocket:
port: 3306
livenessProbe:
exec:
command:
- cat
- /app/is_healthy
Monitor and Debug Applications
Monitoring Tool
- Metric Server
- Prometheus
- Elastic Stack
- DATADOG
- dynatrace
Metric Server는 기본 메트릭 서버인데,
인메모리 솔루션이기 때문에 퍼포먼스를 디스크에 저장하지 않음
kubelet 안에는 cAdvisor가 설치되어 있음
Metrics Server 설치는 다음과 같음
git clone https://github.com/kubernetes-incubator/metrics-server.git
kube create -f deploy/1.8+/
- kubectl top node
위 명령어로 CPU%, MEMORY 를 볼 수 있음
- kubectl top pod
'advanced > Devops' 카테고리의 다른 글
kubeadm on Ubuntu 22.04 설치시 트러블 슈팅 (0) | 2022.09.19 |
---|---|
[CKAD] 2일차 - job & cronjob (0) | 2022.09.16 |
[CKA] 12일차 - HA 설정(ETCD 서버) (0) | 2022.09.02 |
[CKA] 11일차 network(2) - CNI, Ingress, CoreDNS (0) | 2022.08.26 |
[CKA] 10일차 - network(1) network 이론 및 network namespace (0) | 2022.08.26 |