반응형
APP(httpd) 배포 테스트
deployment 생성
$ kubectl create deployment test-httpd --image=httpd
deployment.apps/test-httpd created
Pod/Deployment 확인
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
test-httpd-7f58b4d6cf-8nmx7 1/1 Running 0 41s
$ kubectl get deployment
NAME READY UP-TO-DATE AVAILABLE AGE
test-httpd 1/1 1 1 6m43s
###label 확인
$ kubectl get pod --show-labels
NAME READY STATUS RESTARTS AGE LABELS
test-httpd-7f58b4d6cf-8nmx7 1/1 Running 0 3h4m app=test-httpd,pod-template-hash=7f58b4d6cf
Service 생성
$ kubectl create service nodeport test-httpd --tcp=80:80
service/test-httpd created
Service 확인
$ kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
test-httpd NodePort 10.96.253.169 <none> 80:31965/TCP 73s
cURL 웹 테스트
$ curl 10.96.253.169
<html><body><h1>It works!</h1></body></html>
레플리카셋
레플리카셋 3 늘리기
###replicaset, pod 이름 확인
$ kubectl get replicaset,pod -l app=test-httpd
NAME DESIRED CURRENT READY AGE
replicaset.apps/test-httpd-7f58b4d6cf 1 1 1 3h23m
NAME READY STATUS RESTARTS AGE
pod/test-httpd-7f58b4d6cf-8nmx7 1/1 Running 0 3h23m
###test-httpd-7f58b4d6cf 편집
$ kubectl edit replicaset test-httpd-7f58b4d6cf
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: apps/v1
kind: ReplicaSet
metadata:
annotations:
deployment.kubernetes.io/desired-replicas: "1"
deployment.kubernetes.io/max-replicas: "2"
deployment.kubernetes.io/revision: "1"
creationTimestamp: "2020-11-10T06:30:54Z"
generation: 7
labels:
app: test-httpd
pod-template-hash: 7f58b4d6cf
name: test-httpd-7f58b4d6cf
namespace: default
ownerReferences:
- apiVersion: apps/v1
blockOwnerDeletion: true
controller: true
kind: Deployment
name: test-httpd
uid: 0ad51163-fade-4861-bf71-de47fe7686ef
resourceVersion: "1730548"
selfLink: /apis/apps/v1/namespaces/default/replicasets/test-httpd-7f58b4d6cf
uid: 9bae6a2d-dd4c-49f2-a194-19599d2c1a15
spec:
replicas: 1 ### 1 -> 5
selector:
matchLabels:
app: test-httpd
pod-template-hash: 7f58b4d6cf
template:
metadata:
creationTimestamp: null
labels:
app: test-httpd
pod-template-hash: 7f58b4d6cf
spec:
containers:
- image: httpd
imagePullPolicy: Always
name: httpd
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
status:
availableReplicas: 1
fullyLabeledReplicas: 1
observedGeneration: 7
readyReplicas: 1
728x90
반응형
'리눅스' 카테고리의 다른 글
쿠버네티스에서 실행 중인 컨테이너에 대화형 셀로 접근하는 방법 (0) | 2020.11.11 |
---|---|
쿠버네티스 레플리카셋(Replica Set) (0) | 2020.11.11 |
쿠버네티스에서 NGINX Ingress Controller를 설정하는 방법 (0) | 2020.11.09 |
Kubernetes Dashboard를 설치하고 구성하는 방법 (0) | 2020.11.06 |
[kubernetes] 웹 서버(nginx) 배포(deployment) (0) | 2020.11.05 |