클라우드 엔지니어 꿈나무
Kubernetes Labels - Centos7 본문
Label
Resources 를 그룹화
node 및 pod 지정 가능
명령어
kubectl label node node 1 storage=hdd : storage hdd라는 그룹으로 node 1에서 라벨 생성
kubectl get nodes --show-labels : 라벨과 함께 node 보기
kubectl get pod http --show-labels : 라벨과 함께 pod 보기
kubectl label node node2 storage- : 라벨 명칭 없이 node 2에 라벨 생성
apiVersion: v1
kind: Pod
metadata:
name: http
labels:
apiVersion: v1
kind: Pod
metadata:
name: http
labels:
env: prod
spec:
containers:
- name: apache1
image: httpd
imagePullPolicy: IfNotPresent
ports:
- containerPort: 80
---
apiVersion: v1
kind: Pod
metadata:
name: http1
spec:
containers:
- name: apache2
image: httpd
imagePullPolicy: IfNotPresent
ports:
- containerPort: 80
nodeSelector:
storage: hdd
---
apiVersion: v1
kind: Pod
metadata:
name: http2
spec:
containers:
- name: apache2
image: httpd
imagePullPolicy: Never
ports:
- containerPort: 80
nodeSelector:
storage: ssd
apiVersion: v1
items:
- apiVersion: v1
kind: Pod
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","kind":"Pod","metadata":{"annotations":{},"name":"app-nginx","namespace":"default"},"spec":{"containers":[{"image":"nginx","imagePullPolicy":"IfNotPresent","name":"nginx","ports":[{"containerPort":80}]}]}}
creationTimestamp: "2023-09-11T21:25:38Z"
name: app-nginx
namespace: default
resourceVersion: "44275"
uid: dad9db66-08e7-4521-aa30-7307813aeeeb
spec:
containers:
- image: nginx
imagePullPolicy: IfNotPresent
name: nginx
ports:
- containerPort: 80
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
name: kube-api-access-8fzx9
readOnly: true
dnsPolicy: ClusterFirst
enableServiceLinks: true
nodeName: node1
preemptionPolicy: PreemptLowerPriority
priority: 0
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
serviceAccount: default
serviceAccountName: default
terminationGracePeriodSeconds: 30
tolerations:
'kubernetes' 카테고리의 다른 글
Kubernetes(k8s) Deployments - Centos 7 (0) | 2023.09.13 |
---|---|
Kubernetes(k8s) Replicas - Centos (0) | 2023.09.13 |
Kubernetes Pods - Centos7 (0) | 2023.09.13 |
Kubernetes Namespace - Centos7 (0) | 2023.09.12 |
Kubernetes 설치 - Centos 7 (1) | 2023.09.12 |