지니데비 기록 자세히보기
반응형

쿠버네티스 35

[Kubernetes] 16. Node Selector, Node Affinity

Node SelectorapiVersion: v1kind: Podmetadata:  name: myapp-podspec:  containers:  - name: nginx-container    image: nginx  affinity:    nodeAffinity:      requiredDuringSchedulingIgnoredDuringExecution:        nodeSelectorTerms:        - matchExpressions:          - key: disktype            operator: In            values:            - ssd      preferredDuringSchedulingIgnoredDuringExecution:    ..

[Kubernetes] 15. Taints, Tolerations

TaintTaint는 노드에 붙여서 해당 노드에 특정 Pod가 스케줄링되지 못하도록 하는 제약 조건이다. 노드에 Taint를 적용하면, Taint에 맞는 Toleration이 없는 Pod는 그 노드에 스케줄링되지 않는다.Taint는 Key, Value, 그리고 Effect 세 가지 필드로 구성된다.Effect는 Taint가 가지는 영향을 의미하고, 다음 세 가지 중 하나야:NoSchedule: 이 노드에는 Toleration이 없는 Pod는 스케줄링되지 않는다.PreferNoSchedule: 이 노드에 Toleration이 없는 Pod는 되도록 스케줄링되지 않지만, 꼭 막지는 않는다.NoExecute: 이 노드에 이미 있는 Pod라도 Toleration이 없으면 쫓겨난다.## taint 설정kubectl..

[Kubernetes] 14. Label, Selector, Annotation

Label용도: 리소스를 그룹화하거나 특정 리소스를 쉽게 식별하는 데 사용.구조:키: 영문 소문자와 숫자 사용 가능, 최대 63자.값: 영문 소문자와 숫자, 대시(-), 밑줄(_) 사용 가능.metadata:  labels:    app: my-app    environment: production    version: v1kubectl get pods -l app=my-appSelector용도: 특정 Label을 가진 리소스만 선택해 동작을 제한하고 제어.종류:Equality-based: = 또는 != 연산자 사용. (ex. app=my-app)Set-based: in, notin, exists 등을 이용해 조건에 맞는 리소스를 선택할 수 있다.selector:  matchLabels:    app: ..

[Kubernetes] 13. Scheduling

명시적으로 배포할 Node 지정apiVersion: v1kind: Podmetadata:  name: nginx  labels:    name: nginxspec:  containers:    - name: nginx      image: nginx      ports:        - containerPort: 8080  nodeName: worker02명시하지 않은 경우에는 Scheduler에 의해 Pod를 실행할 Node는 자동으로 지정함이미 배포한 Pod에 대해 Node 지정## Binding 객체 생성apiVersion: v1kind: Bindingmetadata:  name: nginxtarget:  apiVersion: v1  kind: Node  name: worker02

[Kubernetes] 11. Imperative(명령적) vs Declarative(선언적) + 필수암기

Imperative(명령형) 관리## Create objectskubectl run --image=nginx nginxkubectl run hazelcast --image=hazelcast/hazelcast --labels="app=hazelcast,env=prod"kubectl create deployment --image=nginx nginxkubectl expose deployment nginx --port 80## Update objectkubectl edit deployment nginxkubectl scale deployment nginx --replicas=5kubectl set image deployment nginx nginx=nginx:1.18kubectl create -f nginx...

[Kubernetes] 10. Namespace, ResourceQuota

Pod yaml 파일형식 (Namespace 추가)apiVersion: v1kind: Podmetadata: name: myapp-pod namespace: dev labels: app: myapp type: front-endspec: containers: - name: nginx-controller image: nginxPod 생성 시 Namespace 옵션kubectl create -f pod-definition.yaml --namespace=devNamespace 생성## 생성(1) - yaml 정의 후 생성vi namespace-dev.yamlapiVersion: v1kind: Namespacemetadata: name: dev kubectl create -f name..

[Kubernetes] 9. Service

apiVersion: v1kind: Servicemetadata: name: myapp-servicespec: type: NodePort ports: - targetPort: 80 port: 80 nodePort: 30008 selector: app: myapp type: front-end※ selector node의 내용은 Pod yaml의 metadata 노드 내용※ port는 필수값, targetPort, nodePort는 옵션※ port는 Service, targetPort는 Pod, nodePort는 Node 포트번호※ nodePort는 30000-30767Service yaml 파일형식 (ClusterIP)apiVersion: v1kind: Servic..

[Kubernetes] 7. ReplicationController, ReplicaSet

Pod yaml 파일형식apiVersion: v1kind: Podmetadata: name: myapp-pod labels: app: myapp type: front-endspec: containers: - name: nginx-container image: nginx※ 기본 yaml  파일의 형식은 apiVersion, kind, metadata, spec 노드로 구성된다.ReplicationController yaml 파일형식apiVersion: v1kind: ReplicationControllermetadata name: myapp-rc labels: app: myapp type: front-endspec: template: metadata: ..

반응형