Kubernetes - POD YAML작성
Kubernetes 기초
Kubernetes - POD YAML작성
파드 yaml 디스크립션 작성
kuberctl 기본 pod yaml파일
1
kubectl explain pods
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
KIND: Pod
VERSION: v1
DESCRIPTION:
Pod is a collection of containers that can run on a host. This resource is
created by clients and scheduled onto hosts.
FIELDS:
apiVersion <string>
APIVersion defines the versioned schema of this representation of an
object. Servers should convert recognized schemas to the latest internal
value, and may reject unrecognized values. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
kind <string>
Kind is a string value representing the REST resource this object
represents. Servers may infer this from the endpoint the client submits
requests to. Cannot be updated. In CamelCase. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
metadata <Object>
Standard object's metadata. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
spec <Object>
Specification of the desired behavior of the pod. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
status <Object>
Most recently observed status of the pod. This data may not be up to date.
Populated by the system. Read-only. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
연습 문제 겸 POD작성 연습
문제 내용
- 모든 리소스 삭제
- Yaml 사용하여 docker images jenkins 로 jenkins-manual pod 생성하기
- jenkins pod에서 curl 명령어로 localhost:8080 접속하기
- jenkins pod 8888포트 포워딩하기
- 현재 jenkinss-manual 설정 yaml로 출력하기
모든 리소스 삭제
1
2
3
kubectl delete svc --all
kubectl delete deploy --all
kubectl delete pod --all
Yaml 사용하여 docker images jenkins 로 jenkins-manual pod 생성하기
1
2
3
4
5
6
7
8
9
10
apiVersion: v1
kind: Pod
metadata:
name: pod-practice
spec:
containers:
- name: jenkins-manuale
image: jenkins/jenkins:lts-jdk11
ports:
- containerPort: 8080
1
k create -f jenkins-manual.yaml
jenkins pod에서 curl 명령어로 localhost:8080 접속하기
1
kubectl exec pod이름 -- curl localhost:8080 -s
jenkins pod 8888포트 포워딩하기
1
kubectl port-forward pod이름 8888:8080
현재 jenkinss-manual 설정 yaml로 출력하기
1
kubectl get pod pod이름 -o yaml
kubectl YAML 주석 달기
1
kubectl annotate pod 파드이름 test123=test123
This post is licensed under CC BY 4.0 by the author.
