brunch

You can make anything
by writing

C.S.Lewis

by Master Seo Feb 23. 2023

18. 오라클 클라우드-쿠버네티스-오토스케일링

<1> 오토 스케일링 3가지

<2> 부하 테스트 환경 만들기



<1> 오토 스케일링 3가지


1

HPA - 서버수를 늘리는 것 , Scale-Out

(Horizontal Pod Autoscaling) 


2

VPA - 서버 사용을 높이는것, 스케일 업. Scale-UP

(Vertical Pod Autoscaling)


3

CA는 Node 수를 늘리는것

Cluster Autocaler

CA 는 클라우드 사업자가 제공해야 한다.

node 수 자체를 늘려준다.



<2> 부하 테스트 환경 만들기


1

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get ns,no,po,svc,deploy,rs,ing,ep -o wide

NAME                        STATUS   AGE

namespace/default           Active   8d

namespace/hello             Active   41h

namespace/kube-node-lease   Active   8d

namespace/kube-public       Active   8d

namespace/kube-system       Active   8d


NAME               STATUS   ROLES   AGE   VERSION   INTERNAL-IP   EXTERNAL-IP   OS-IMAGE                  KERNEL-VERSION                      CONTAINER-RUNTIME

node/10.0.10.141   Ready    node    8d    v1.25.4   10.0.10.141   <none>        Oracle Linux Server 8.6   5.4.17-2136.314.6.2.el8uek.x86_64   cri-o://1.25.1-111.el8

node/10.0.10.80    Ready    node    8d    v1.25.4   10.0.10.80    <none>        Oracle Linux Server 8.6   5.4.17-2136.314.6.2.el8uek.x86_64   cri-o://1.25.1-111.el8


NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE   SELECTOR

service/kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP   25h   <none>

NAME                       ENDPOINTS   AGE

endpoints/oracle.com-oci   <none>      41h


2

topasvga@cloudshell:~ (ap-seoul-1)$ cat << EOF > php-apache.yaml 

> apiVersion: apps/v1

> kind: Deployment

> metadata:

>   name: php-apache

> spec:

>   selector:

>     matchLabels:

>       run: php-apache

>   replicas: 1

>   template:

>     metadata:

>       labels:

>         run: php-apache

>     spec:

>       containers:

>       - name: php-apache

>         image: k8s.gcr.io/hpa-example

>         ports:

>         - containerPort: 80

>         resources:

>           limits:

>             cpu: 500m

>           requests:

>             cpu: 200m

> ---

> apiVersion: v1

> kind: Service

> metadata:

>   name: php-apache

>   labels:

>     run: php-apache

> spec:

>   ports:

>   - port: 80

>   selector:

>     run: php-apache

> EOF




3

디플로이먼트와 서비스가 생긴다


topasvga@cloudshell:~ (ap-seoul-1)$ kubectl apply -f php-apache.yaml 

deployment.apps/php-apache created

service/php-apache created



4

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get ns,no,po,svc,deploy,rs,ing,ep -o wide

top - 02:18:01 up 8 days, 15:40,  0 users,  load average: 0.10, 0.14, 0.11

Tasks:   8 total,   1 running,   7 sleeping,   0 stopped,   0 zombie

%Cpu(s):  0.7 us,  1.0 sy,  0.0 ni, 98.2 id,  0.0 wa,  0.0 hi,  0.0 si,  0.2 st

KiB Mem:  16090880 total, 10555076 used,  5535804 free,     3296 buffers

KiB Swap:        0 total,        0 used,        0 free.  8614060 cached Mem

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND 

      1 root      20   0  166264  19084  13812 S   0.0  0.1   0:00.07 apache2                                    7 www-data  20   0  166288   7116   1832 S   0.0  0.0   0:00.00 apache2                                  8 www-data  20   0  166288   7116   1832 S   0.0  0.0   0:00.00 apache2                                  9 www-data  20   0  166288   7116   1832 S   0.0  0.0   0:00.00 apache2                                 10 www-data  20   0  166288   7116   1832 S   0.0  0.0   0:00.00 apache2                                 11 www-data  20   0  166288   7116   1832 S   0.0  0.0   0:00.00 apache2                                 12 root      20   0   20244   3116   2820 S   0.0  0.0   0:00.00 bash                                             17 root      20   0   21940   2464   2100 R   0.0  0.0   0:00.00 top                                            

                                                                                                                                            5        

root@php-apache-6766b988d9-b7c4v:/var/www/html# exit

exit

command terminated with exit code 127



6

topasvga@cloudshell:~ (ap-seoul-1)$ kubectl get svc

NAME         TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)   AGE

kubernetes   ClusterIP   10.96.0.1       <none>        443/TCP   25h

php-apache   ClusterIP   10.96.113.238   <none>        80/TCP    7m2s


topasvga@cloudshell:~ (ap-seoul-1)$ SVCIP=10.96.113.238

topasvga@cloudshell:~ (ap-seoul-1)$ curl $SVCIP;echo


oracle cloudshell 환경에서는 clusterip 로 접속이 안됨.

별도 서버에서 테스트 필요함.

아래 내용 참고해 테스트 바랍니다.

https://brunch.co.kr/@topasvga/1728



감사합니다.

매거진의 이전글 17. 오라클 클라우드 - 쿠버네티스 - Pod수 제한
브런치는 최신 브라우저에 최적화 되어있습니다. IE chrome safari