CKA pod part solution
컨텐츠 정보
- 1,637 조회
- 0 추천
-
목록
본문
## pod 조회
```
kubectl get pods
```
## 새로운 Pod 생성
> Create a new pod with the `nginx` image
```
kubectl run nginx --image=nginx
// ouput
pod/nginx created
```
### pod 조회
```
kubectl get pods
```
### describe pod
```
kubectl describe pod {pod_name}
```
> which nodes are theses pods placed on?
```
kubectl describe pod {pod_name} -o wide
```
#### How may containers part of the pod {name}?
```
kubectl describe pod {name}
// ouput
pod "{name}" deleted
```
## Delete Pod
```
kubectl delete pod {name}
pod "webapp" deleted
```
## image 수정
Create a new pod with the name `redis` and with the image `redis444`
Use a pod-definnition YAML file.
And yes the images name is wrong!
* Name: `redis`
* Image Name: `redies444`
```
kubectl run redis --image=redis444 -dry-run=client -o yaml
```
### output
```
apiVersion: v1
kind: Pod
Metedata:
creationTimestamp: null
labels:
run: redis
name: redies
spec:
containers:
- image: redis444
name: redis
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}
```
### Yaml로 저장
```
kubectl run redis --image=redis444 -dry-run=client -o yaml > redis.yaml
```
### 생성
```
kubectl create -f redis.yaml
```
#### ouput
```
pod/redis created
```
### 생성 확인
```
kubectl get pods
```
> output에 에러이미지라고 나온다.
> 이것을 수정해야 함 (fix)
#### yaml 파일 수정
```
apiVersion: v1
kind: Pod
Metedata:
creationTimestamp: null
labels:
run: redis
name: redies
spec:
containers:
- image: redis444를 redis로 수정
name: redis
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}
```
```
kubectl apply -f redis.yaml
kubectl get pods
```
### 성공 확인
> Error 가 Running으로 변경 되었다.
관련자료
댓글 0
등록된 댓글이 없습니다.