Q1. We have deployed a number of PODs. They are labelled with tier, env and bu. How many PODs exist in the dev environment (env)?
k get pods --selector env=dev # env가 dev인 파드 불러오기
k get pods --selector env=dev --no-headers | wc -l #개수 세기
Q2. How many PODs are in the finance business unit (bu)?
k get pods --selector bu=finance --no-headers | wc -l
'''--no-headers를 하지 않으면 헤더까지 카운팅 되기 때문에 제외해야함'''
Q3. How many objects are in the prod environment including PODs, ReplicaSets and any other objects?
k get all --selector env=prod # 전체 보기
k get all --selector env=prod --no-headers | wc -l
Q4. Identify the POD which is part of the prod environment, the finance BU and of frontend tier?
k get pods --selector env=prod,bu=finance,tier=frontend
Q5. A ReplicaSet definition file is given replicaset-definition-1.yaml. Try to create the replicaset. There is an issue with the file. Try to fix it.
selector와 labels 가 매칭될 수 있게 수정함.
vi replicaset-definition-1.yaml
k apply -f replicaset-definition-1.yaml #적용
---
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: replicaset-1
spec:
replicas: 2
selector:
matchLabels:
tier: front-end
template:
metadata:
labels:
tier: front-end
spec:
containers:
- name: nginx
image: nginx
'STUDY > Data Engineering' 카테고리의 다른 글
[kodekloud] 02 Scheduling : Node Affinity 풀이 (0) | 2023.01.23 |
---|---|
[kodekloud] 02 Scheduling : Taints and Tolerations 풀이 (0) | 2023.01.23 |
[kodekloud] 02 Scheduling : Manual Scheduling 풀이 (0) | 2023.01.21 |
[kodekloud] 01 Core Concepts : Imperative-Commands 풀이 (0) | 2023.01.21 |
[kodekloud] 01 Core Concepts : Service 풀이 (0) | 2023.01.21 |