kubernetes 맛보기-4. Deployment
1. yaml 파일 작성
아래와 같이 yaml 파일을 작성한다.
구조를 보면 알겠지만, deployment는 replicas를 포함한다.
apiVersion: apps/v1
kind: Deployment
metadata:
name: deploy-jenkins
labels:
app: jenkins
spec:
replicas: 3
selector:
matchLabels:
app: jenkins
template:
metadata:
labels:
app: jenkins
spec:
containers:
- name: jenkins
image: jenkins
ports: 8080
2. 생성 및 pod 확인
아래 명령을 통해 deployment를 생성하고 pod을 확인한다.
kubectl create -f <파일명>
그림과 같이 정상적으로 pod이 생성되는것을 확인할수 있다.
3. 자세히 보기
아래 명령을 통해 좀더 자세히 본다.
kubectl get all
그림과 같이, replicaset과 service가 함께 생성되었다.
4. scale 명령 사용하기
deployment는 replication controller를 포함하고 있다고 보면 된다.
따라서 rc와 동일하게 scale 가능하고 label명 변경시 replicas가 변경된다는것을 확인할수 있다.
kubectl scale deploy deploy-jenkins --replicas=7
Author And Source
이 문제에 관하여(kubernetes 맛보기-4. Deployment), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@ifthenelse/kubernetes-맛보기-4.-Deployment저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)