[Kubernetes] CKA 시험 준비 - Core Resoureces
4461 단어 kubernetesckacka
Core Resoureces
Pod
Create Pod (imperative)
busybox
이미지를 사용하여,foo
라는 이름의 팟 생성$ kubectl run foo --image=busybox
expose port
$ kubectl run foo --image=busybox --port=8080
Create Pod (declarative)
busybox
이미지를 사용하여,foo
라는 이름의 팟 생성$ kubectl run foo --image=busybox --dry-run=client -o yaml > foo.yaml $ cat foo.yaml apiVersion: v1 kind: Pod metadata: creationTimestamp: null labels: run: foo name: foo spec: containers: - image: busybox name: foo resources: {} dnsPolicy: ClusterFirst restartPolicy: Always status: {} $ kubectl apply -f foo.yaml pod/foo created
Pod이 위치한 노드 확인
$ kubectl get pods foo -o wide
Replicaset
Replicaset에 사용된 이미지 확인
$ kubectl describe replicasets | grep Image
Replicaset의
apiVersion
은apps/v1
이다.
Replicaset scaling
foo
라는 이름의 Replicaset에 속한 Pod 개수를 3개로 수정$ kubectl scale --replicas=3 rs/foo
Deployment
Create Deployment: Imperative
foo
라는 이름의 Deployment를busybox
이미지를 사용하여 3개의 replica로 생성$ kubectl create deployment foo --replicas=3 --image=busybox
Create Deployment: Declarative
$ kubectl create deployment foo --replicas=3 --image=busybox --dry-run=client -o yaml > foo.yaml $ kubectl apply -f foo.yaml
Namespace
Get Pods in a namespace
$ kubectl get pods -n bar
Get Pods in all namespace
$ kubectl get pods --all-namespaces
Create a Pod to a namespace: Imperative
$ kubectl create foo --image=bar -n zoo
Service
Get target port of a service
$ kubectl describe svc foo | grep TargetPort
Create a Nodeport: Imperative
$ kubectl create service nodeport foo --tcp=80:80 --node-port=30080
Create a Nodeport: Declarative
$ kubectl create service nodeport foo --tcp=80:80 --node-port=30080 --dry-run=client -o yaml > foo.yaml $ kubectl apply -f foo.yaml
Author And Source
이 문제에 관하여([Kubernetes] CKA 시험 준비 - Core Resoureces), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@koo8624/Kubernetes-CKA-시험-준비저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)