실행되고 있는 DaemonSets 갯수를 찾으세요
나의 답안 )
kubectl get daemonset -A --no-headers | wc -l
Solution )
나의 답안과 같음
다른 네임스페이스에 있는 특정 DaemonSet가 생성한 파드가 몇 개 인지 찾으세요
나의 답안 )
kubectl describe daemonset <DaemonSet> -n=<namespace>
Solution )
kubectl describe daemonset <DaemonSet> -n=<namespace>
도 가능하지만 사실
kubectl get daemonset <DaemonSet> 만으로 파드의 desire 값, current, ready등등 지표가 출력된다
DaemonSet을 생성하세요
Name: elasticsearch
Namespace: kube-system
Image: registry.k8s.io/fluentd-elasticsearch:1.20
나의 답안 )
쿠버네티스 공식 페이지의 DaemonSet Manifest 활용
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: elasticsearch
namespace: kube-system
labels:
k8s-app: fluentd-logging
spec:
selector:
matchLabels:
name: fluentd-elasticsearch
template:
metadata:
labels:
name: fluentd-elasticsearch
spec:
tolerations:
# these tolerations are to have the daemonset runnable on control plane nodes
# remove them if your control plane nodes should not run pods
- key: node-role.kubernetes.io/control-plane
operator: Exists
effect: NoSchedule
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
containers:
- name: fluentd-elasticsearch
image: registry.k8s.io/fluentd-elasticsearch:1.20
resources:
limits:
memory: 200Mi
requests:
cpu: 100m
memory: 200Mi
volumeMounts:
- name: varlog
mountPath: /var/log
# it may be desirable to set a high priority class to ensure that a DaemonSet Pod
# preempts running Pods
# priorityClassName: important
terminationGracePeriodSeconds: 30
volumes:
- name: varlog
hostPath:
path: /var/log
kubectl apply -f elastic.yaml
Solution )
deploy와 manifest 형식이 비슷하기 때문에
kubectl create deployment elasticsearch -n kube-system --image=registry.k8s.io/fluentd-elasticsearch:1.20 --dry-run=client -o yaml > ./elasticsearch.yaml
manifest 수정 진행
apiVersion은 deploy, daemonset 모두 apps/v1으로 동일, kind를 Deployment에서 DaemonSet으로 변경
'DevOps' 카테고리의 다른 글
CKA 예제 리마인더 - 12. Multiple Schedulers (0) | 2024.10.31 |
---|---|
CKA 예제 리마인더 - 11. Static PODs (0) | 2024.10.31 |
CKA 예제 리마인더 - 9. Resource Limits (1) | 2024.10.30 |
Kubernetes - Taints Tolerations, Node Affinity 예시 (1) | 2024.10.29 |
Kubernetes - Node Affinity.Operator (0) | 2024.10.29 |