# (옵션) 마스터 - 터미널1
watch -d 'kubectl get pods,rs,deploy -o wide'
# (옵션) 노드 - 터미널1
watch -d 'docker ps --format "table {{.Image}}\t{{.Status}}\t{{.Names}}" | grep -v pause'
# 생성
curl -s -O https://raw.githubusercontent.com/gasida/DKOS/main/4/replicaset-cndk.yaml
kubectl apply -f replicaset-cndk.yaml- 디플로이먼트 생성 및 확인
# (옵션) 마스터 - 터미널1
watch -d 'kubectl get pods,rs,deploy -o wide'
# (옵션) 노드 - 터미널1
watch -d 'docker ps --format "table {{.Image}}\t{{.Status}}\t{{.Names}}" | grep -v pause'
# 생성
curl -s -O https://raw.githubusercontent.com/gasida/DKOS/main/4/deployment-cndk.yaml- daemonset-1.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: daemonset-1
spec:
selector:
matchLabels:- pod.yaml 파일 내용 참고
apiVersion: apps/v1
kind: Deployment
metadata:
name: deploy-cndk
spec:
replicas: 3
selector:- nginx11.yaml 디플로이먼트 (이전 실습에서 배포한) 생성 및 확인
# (옵션) 터미널1
watch -d 'kubectl get pods,svc,ep -o wide'
혹은
watch -d 'kubectl get pods,svc -o wide'
# (옵션) 노드
watch -d 'docker ps --format "table {{.Image}}\t{{.Status}}\t{{.Names}}" | grep -v pause'- ExternalName 실습
# 서비스(ExternalName) 생성
cat <<EOT> svc-ext-cndk.yaml
apiVersion: v1
kind: Service
metadata:
name: academy
spec:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| name: azure-lb-websrv | |
| spec: | |
| type: LoadBalancer | |
| ports: | |
| - port: 80 | |
| targetPort: 8080 | |
| selector: |
-
참고: 해당 실습은 Azure 클라우드에서 실습하는 것을 기준으로 구성
-
먼저 Azure Kubernetes Service를 만든다 (예: 리소스 그룹:
osamtest, 리소스 이름:osamaks) -
Azure Cloud Shell을 실행하고, 쿠버네티스 서비스에 접근 가능하도록 config 파일을 받아온다.
-
참고: 쿠버네티스 config 파일을 통해 다른 리눅스 터미널에서도
kubectl명령어만 설치되어 있으면 명령어 실행이 가능함
# Azure Cloud Shell에서 아래 명령을 실행하여 config 파일을 만든다.- 참고: 인터넷 상에 여러 YAOBank yaml 파일이 있는데, 그 중 현재 기준으로 Star/Fork가 가장 많은 것을 참고
# 생성
curl -s -O https://raw.githubusercontent.com/tigera/ccol1/main/yaobank.yaml
sed -i 's/nodeSelector/#nodeSelector/g' yaobank.yaml && sed -i 's/kubernetes.io/#kubernetes.io/g' yaobank.yaml
kubectl apply -f yaobank.yaml