본문 바로가기

반응형

kubernetes

node-app 도커 이미지를 쿠버네티스로 배포하는 방법 node-app 도커 이미지를 쿠버네티스(Kubernetes)로 배포하는 방법 node-app-deployment.yaml 파일 생성 vim node-app-deployment.yaml # node-app-deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: node-app # Deployment의 이름 spec: replicas: 1 # Replica 수 selector: matchLabels: app: node-app # Pod를 식별하기 위한 라벨 template: metadata: labels: app: node-app # Pod에 부여되는 라벨 name: node-app # Pod의 이름 spec: containers: - n.. 더보기
쿠버네티스 네임스페이스를 생성하고 확인하고 삭제하는 방법(namespaces) 쿠버네티스 네임스페이스를 생성하고 확인하고 삭제하는 방법(namespaces) 쿠버네티스에서는 네임스페이스를 통해 리소스를 격리하고 조직화할 수 있습니다. 네임스페이스 확인 kubectl get namespaces $ kubectl get namespaces NAME STATUS AGE default Active 2d1h ingress-nginx Active 2d1h kube-node-lease Active 2d1h kube-public Active 2d1h kube-system Active 2d1h metallb-system Active 2d1h kubectl get pods --namespace kube-system kubectl get all --namespace kube-system 네임스페이스 .. 더보기
[kubernetes] kubectl get 명령 kubectl get 명령 kubectl get field selector kubectl get pods -o wide --field-selector status.phase=Running $ kubectl get pods -o wide --field-selector status.phase=Running NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES myapp-rs-dynamic-4gchk 1/1 Running 0 23m 10.233.118.66 kube-node3 myapp-rs-dynamic-7wqq4 1/1 Running 0 23m 10.233.73.68 kube-node1 myapp-rs-dynamic-bgmf5 1/1 .. 더보기
[kubernetes] kubectl delete 명령 kubectl delete 명령 Delete resources by file names, stdin, resources and names, or by resources and label selector. 사용법 Examples: # Delete a pod using the type and name specified in pod.json kubectl delete -f ./pod.json # Delete resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml kubectl delete -k dir # Delete a pod based on the type and name in the JSON passed i.. 더보기
[kubernetes] 쿠버네티스 워크로드 - 네임스페이스(namespaces) 워크로드 - 네임스페이스(namespaces) 네임스페이스 확인 kubectl get namespaces $ kubectl get namespaces NAME STATUS AGE default Active 2d1h ingress-nginx Active 2d1h kube-node-lease Active 2d1h kube-public Active 2d1h kube-system Active 2d1h metallb-system Active 2d1h kubectl get pods --namespace kube-system kubectl get all --namespace kube-system 네임스페이스 생성 kubectl create namespace infrateam $ kubectl create namesp.. 더보기
[kubernetes] 쿠버네티스 볼륨(Volume) - 정적 프로비저닝(Static Provisioning) / nfs 쿠버네티스 정적 프로비저닝(Static Provisioning) nfs 서버 구성(kube-control1) - nfs 서버 구성 : https://sangchul.kr/432 nfs 클라이언트 구성(kube-node1, kube-node2, kube-node3) sudo apt install -y nfs-common showmount -e 192.168.56.11 $ showmount -e 192.168.56.11 Export list for 192.168.56.11: /nfs-directory/shares-data1 192.168.56.0/24 PV(Persistent Volume) 생성 nfs-pv1.yaml 파일 작성 vim nfs-pv1.yaml apiVersion: v1 kind: Persis.. 더보기
[kubernetes] 쿠버네티스 워크로드 - 워크로드 리소스 쿠버네티스 워크로드 - 워크로드 리소스 디플로이먼트(Deployment) : 모든 Pod가 필요시 교체 또는 상호 교체할 수 있는 경우, 클러스터의 스테이트리스 애플리케이션 워크로드를 관리하기에 적합 레플리카셋(ReplicaSet) - 레거시 리소스 레플리케이션컨트롤러(ReplicationController)를 대체 : 레플리카 파드 집합의 실행을 항상 안정적으로 유지하는 것이다. 이처럼 레플리카셋은 보통 명시된 동일 파드 개수에 대한 가용성을 보증하는 데 사용한다. 스테이트풀셋(StatefulSet) : 어떻게든 스테이트(state)를 추적하는 하나 이상의 파드를 동작하게 해준다. 예를 들면, 워크로드가 데이터를 지속적으로 기록하는 경우, 사용자는 Pod와 PersistentVolume을 연계하는 St.. 더보기
[kubernetes] 쿠버네티스 볼륨(Volume) - hostPath 볼륨 쿠버네티스 hostPath 볼륨 hostPath 볼륨 hostPath 볼륨 생성 hostPath1.yaml 파일 작성 apiVersion: apps/v1 kind: ReplicaSet metadata: name: myapp-rs-hostpath spec: replicas: 2 selector: matchLabels: app: myapp-rs-hostpath template: metadata: labels: app: myapp-rs-hostpath spec: containers: - name: web-server image: nginx:alpine volumeMounts: - name: web-content mountPath: /usr/share/nginx/html readOnly: true ports: .. 더보기

728x90
반응형