본문 바로가기
Cloud/Kubenetes

ReplicaSet 실습 (Scale, edit, label), status pending, ContainerCreating

by tankwoong 2023. 10. 31.
반응형


1. jenkins 디플로이먼트를 deploy-jenkins를 생성하라.
2. jenkins 디플로이먼트로 배포되는 앱을 app: jenkins-test로 레이블링 하라.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: deploy-jenkins
  labels:
    app: jenkins-test
spec:
  replicas: 3
  selector:
    matchLabels:
      app: jenkins-test
  template:
    metadata:
      labels:
        app: jenkins-test
    spec:
      containers:
      - name: jenkins
        image: jenkins/jenkins
        ports:
        - containerPort: 8080
      imagePullSecrets:
      - name: secretdoc
kubectl apply -f jenkins.yml

3. 디플로이먼트로 배포된 파드를 하나 삭제하고 이후 생성되는 파드를 관찰하라.

kubectl delete pod/deploy-jenkins-7bd488cdb-v87pj

 

kubectl label pod [pod 이름] app-


5. Scale 명령을 사용해 레플리카 수를 5개로 정의한다.

kubectl scale deployment deploy-jenkins --replicas=5

6. edit 기능을 사용하여 10으로 스케일아웃하라

kubectl edit deploy deploy-jenkins

 

트러블 슈팅 

계속해서 Pending 상태인 경우 

아래와 같이 Pending이 뜰 경우가 있다.

많은 이유가 있겠지만 work node를 켜지 않았을 경우 

Pending 상태가 될 수 있다.

 

자세한 것은 kubectl describe pods로 확인한다.

계속해서 Container Creating인 상태인 경우 

root@master:~# kubectl describe pods

를 사용해서 오류상태를 확인한다.

kubectl create secret docker-registry secretdoc --docker-username=[dockerhub id] --docker-password=[dockerhub password]

 

 

 

반응형