Skip to content

Instantly share code, notes, and snippets.

View ianychoi's full-sized avatar

Ian Y. Choi ianychoi

View GitHub Profile
@ianychoi
ianychoi / K8s-ReplicaSet.md
Last active July 19, 2021 14:03
쿠버네티스 - ReplicaSet
# (옵션) 마스터 - 터미널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
@ianychoi
ianychoi / K8s-Deployment.md
Last active July 26, 2021 15:47
쿠버네티스 - Deployment
  • 디플로이먼트 생성 및 확인
# (옵션) 마스터 - 터미널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
@ianychoi
ianychoi / K8s-DaemonSetJobs.md
Last active July 26, 2021 17:35
쿠버네티스 - DaemonSet & Jobs
  • daemonset-1.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: daemonset-1
spec:
  selector:
    matchLabels:
@ianychoi
ianychoi / K8s-ClusterIP.md
Created July 27, 2021 15:44
쿠버네티스 - Cluster IP 실습
  • pod.yaml 파일 내용 참고
apiVersion: apps/v1
kind: Deployment
metadata:
  name: deploy-cndk
spec:
  replicas: 3
  selector:
@ianychoi
ianychoi / K8s-BlueGreen.md
Created July 27, 2021 16:27
쿠버네티스 - Blue Green 배포 (클러스터 서비스 활용)

클러스터 IP 서비스를 활용해 Blue Green 배포 전략을 실습해봅니다.

  • 디플로이먼트 2개 생성
  • nginx11.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: deploy-nginx11
@ianychoi
ianychoi / K8s-NodePort.md
Last active July 27, 2021 18:42
쿠버네티스 - NodePort 서비스 실습
  • 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'
@ianychoi
ianychoi / K8s-ExternalName.md
Last active July 27, 2021 17:43
쿠버네티스 - External Name (외부 이름)
  • ExternalName 실습
# 서비스(ExternalName) 생성
cat <<EOT> svc-ext-cndk.yaml
apiVersion: v1
kind: Service
metadata:
  name: academy
spec:
@ianychoi
ianychoi / azure-lb.yaml
Created July 31, 2021 02:58
K8s-AKS-Loadbalancer 실습 파일
apiVersion: v1
kind: Service
metadata:
name: azure-lb-websrv
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 8080
selector:
@ianychoi
ianychoi / K8s-LoadBalancer.md
Last active July 31, 2021 12:48
쿠버네티스 - LoadBalancer 서비스 실습

쿠버네티스 - LoadBalancer 서비스 실습

  • 참고: 해당 실습은 Azure 클라우드에서 실습하는 것을 기준으로 구성

  • 먼저 Azure Kubernetes Service를 만든다 (예: 리소스 그룹: osamtest, 리소스 이름: osamaks)

  • Azure Cloud Shell을 실행하고, 쿠버네티스 서비스에 접근 가능하도록 config 파일을 받아온다.

  • 참고: 쿠버네티스 config 파일을 통해 다른 리눅스 터미널에서도 kubectl 명령어만 설치되어 있으면 명령어 실행이 가능함

# Azure Cloud Shell에서 아래 명령을 실행하여 config 파일을 만든다.
@ianychoi
ianychoi / K8s-YAOBank.md
Last active July 31, 2021 15:02
쿠버네티스 - MSA 앱 배포 (YAOBank) 실습
# 생성
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