참고:
- 이 자습서는 Oracle에서 제공하는 무료 실습 환경에서 사용할 수 있습니다.
- Oracle Cloud Infrastructure 인증서, 테넌시 및 구획에 예제 값을 사용합니다. 실습을 마치면 이 값을 클라우드 환경에 고유한 값으로 대체하십시오.
Oracle Cloud Native 환경에서 Kubernetes 클러스터 확장
소개
이 사용지침서에서는 Oracle Cloud Native Environment에서 기존 Kubernetes 클러스터를 확장하는 방법을 설명합니다.
Kubernetes 클러스터를 확장하려면 노드를 추가하는 것을 의미합니다. 마찬가지로 노드를 제거하면 축소도 발생합니다. 노드는 제어 플레인 또는 작업자 노드일 수 있습니다. Oracle은 동시에 클러스터를 확장 및 축소할 것을 권장합니다. 대신 두 개의 별도 명령으로 스케일 업을 수행한 다음 스케일 다운을 수행합니다.
정보 분리(split-brain) 시나리오를 방지하고 쿼럼을 유지하려면 Kubernetes 클러스터 제어 플레인 또는 작업자 노드를 홀수 단위로 확장하는 것이 좋습니다. 예를 들어, 3, 5 또는 7개의 제어 플레인 또는 작업자 노드는 클러스터의 안정성을 보장합니다.
이 사용지침서에서는 Oracle Cloud Native Environment에서 실행되는 기존의 고가용성 Kubernetes 클러스터를 사용하며 3개의 모듈이 배포되어 있습니다.
- Kubernetes(
kubernetes
) - Helm(
helm
) - Oracle Cloud Infrastructure Cloud Controller Manager 모듈(
oci-ccm
)
시작 배치는 다음으로 구성됩니다.
- 1 운영자 노드
- 3 컨트롤 플레인 노드
- 5 워커 노드
랩을 기반으로 구축됩니다.
- Oracle Cloud Native Environment 배포
- Oracle Cloud Native Environment로 외부 로드 밸런서 배포
- Oracle Cloud Native Environment에서 OCI Cloud Controller Manager 사용
목표
이 사용지침서/랩에서는 두 개의 새로운 제어창 노드와 두 개의 새로운 작업자 노드를 구성하고 클러스터에 추가하는 과정을 안내합니다. 이 자습서/연습에서는 클러스터에서 동일한 노드를 제거하여 클러스터를 축소하는 방법을 보여줍니다.
이 시나리오에서는 X.509 개인 CA 인증서를 사용하여 노드 간 통신을 보안합니다. HashiCorp Vault 암호 관리자를 사용하거나 신뢰할 수 있는 CA(인증 기관)에서 서명한 고유의 인증서를 사용하는 등 인증서를 관리하고 배치하는 다른 방법이 있습니다. 이러한 다른 방법은 이 튜토리얼에 포함되지 않습니다.
필요 조건
주: 무료 실습 환경을 사용하는 경우 이러한 필수 조건이 시작점으로 제공됩니다.
Oracle Cloud Native Environment에서 실행되는 고가용성 Kubernetes 클러스터의 요구사항 외에도 다음이 필요합니다.
-
다음으로 사용할 추가 Oracle Linux 시스템 4개:
- 2 Kubernetes 컨트롤 플레인 노드
- Kubernetes 워커 노드 2개
-
로드 밸런서 액세스(무료 실습 환경에서는 OCI 로드 밸런서를 사용함)
-
시스템에는 다음이 포함되어야 합니다.
- UEK R6(Unbreakable Enterprise Kernel Release 6)를 설치하고 실행하는 최소 최신 Oracle Linux 8(x86_64)
- Oracle Cloud Native Environment를 설치하기 위한 필수 단계 완료
실습 환경 설정
주: 무료 실습 환경을 사용하는 경우 연결 및 기타 사용 지침은 Oracle Linux Lab Basics를 참조하십시오.
정보: 무료 실습 환경은 환경을 생성할 준비가 된 제공된 노드에 Oracle Cloud Native Environment를 배포합니다. 이 배치는 실행 후 20-25분 정도 걸립니다. 따라서 이 작업이 실행되는 동안 다른 단계로 진행한 다음 연습으로 돌아갈 수 있습니다.
별도의 설명이 없는 한 무료 실습 환경 내의 모든 단계를 ocne-operator 노드에서 실행할 수 있으며, 터미널 창을 열고 노드에 연결하는 방식으로 시작하는 것이 좋습니다. Oracle Cloud Native Environment의 다중 노드 설치에서 kubectl
명령은 운영자, 제어 플레인 노드 또는 kubectl
에 대해 구성된 다른 시스템에서 실행됩니다.
-
터미널을 열고 ssh를 통해 ocne-operator 시스템에 연결합니다.
ssh oracle@<ip_address_of_ol_node>
Kubernetes 모듈 설치
중요 달리 명시되지 않는 한 모든 작업은 ocne-operator 노드에서 실행됩니다.
무료 실습 환경에서는 배포 중에 환경 및 모듈 구성 준비를 포함하여 고가용성 Oracle Cloud Native Environment 설치가 생성됩니다.
-
myenvironment.yaml
파일을 확인합니다.cat ~/myenvironment.yaml
무료 실습 환경 배포에서는 클러스터를 생성할 때 제어 플레인 노드 3개와 작업자 노드 5개를 사용합니다.
예제 출력:
[oracle@ocne-operator ~]$ cat ~/myenvironment.yaml environments: - environment-name: myenvironment globals: api-server: 127.0.0.1:8091 secret-manager-type: file olcne-ca-path: /etc/olcne/configs/certificates/production/ca.cert olcne-node-cert-path: /etc/olcne/configs/certificates/production/node.cert olcne-node-key-path: /etc/olcne/configs/certificates/production/node.key modules: - module: kubernetes name: mycluster args: container-registry: container-registry.oracle.com/olcne load-balancer: 10.0.0.168:6443 master-nodes: - ocne-control01.lv.vcnf998d566.oraclevcn.com:8090 - ocne-control02.lv.vcnf998d566.oraclevcn.com:8090 - ocne-control03.lv.vcnf998d566.oraclevcn.com:8090 worker-nodes: - ocne-worker01.lv.vcnf998d566.oraclevcn.com:8090 - ocne-worker02.lv.vcnf998d566.oraclevcn.com:8090 - ocne-worker03.lv.vcnf998d566.oraclevcn.com:8090 - ocne-worker04.lv.vcnf998d566.oraclevcn.com:8090 - ocne-worker05.lv.vcnf998d566.oraclevcn.com:8090 selinux: enforcing restrict-service-externalip: true restrict-service-externalip-ca-cert: /etc/olcne/configs/certificates/restrict_external_ip/production/ca.cert restrict-service-externalip-tls-cert: /etc/olcne/configs/certificates/restrict_external_ip/production/node.cert restrict-service-externalip-tls-key: /etc/olcne/configs/certificates/restrict_external_ip/production/node.key - module: helm name: myhelm args: helm-kubernetes-module: mycluster - module: oci-ccm name: myoci oci-ccm-helm-module: myhelm oci-use-instance-principals: true oci-compartment: ocid1.compartment.oc1..aaaaaaaau2g2k23u6mp3t43ky3i4ky7jpyeiqcdcobpbcb7z6vjjlrdnuufq oci-vcn: ocid1.vcn.oc1.eu-frankfurt-1.amaaaaaaw6qx2pia2xkfmnnknpk3jll6emb76gtcza3ttbqqofxmwjb45rka oci-lb-subnet1: ocid1.subnet.oc1.eu-frankfurt-1.aaaaaaaawfjs5zrb6wdmg43522a4l5aak5zr6vvkaaa6xogttha2ufsip7fq
노드에 대한 FQDN의 도메인 부분은 무료 실습 환경을 배포할 때마다 고유하게 됩니다.
-
Kubernetes 모듈을 설치합니다.
olcnectl module install --config-file myenvironment.yaml
참고: Kubernetes를 노드에 배포하는 데 20-25분이 걸립니다.
예제 출력:
[oracle@ocne-operator ~]$ olcnectl module install --config-file myenvironment.yaml Modules installed successfully. Modules installed successfully. Modules installed successfully.
Modules installed successfully라는 세 개의 응답이 있는 이유는 무엇입니까? 이 예에서 사용되는
myenvironment.yaml
파일은 세 개의 개별 모듈을 정의하기 때문입니다.- module: kubernetes
- module: helm
- module: oci-ccm
나중에 이러한 단계에서 일부 응답이
myenvironment.yaml
파일에 정의된 각 모듈에 대해 한 번씩 세 번 반환되므로 이 사실을 이해하는 것이 중요합니다. -
Kubernetes 모듈 배치를 확인합니다.
olcnectl module instances --config-file myenvironment.yaml
예제 출력:
[oracle@ocne-operator ~]$ olcnectl module instances --config-file myenvironment.yaml INSTANCE MODULE STATE mycluster kubernetes installed myhelm helm installed myoci oci-ccm installed ocne-control01.lv.vcnf998d566.oraclevcn.com:8090 node installed ocne-control02.lv.vcnf998d566.oraclevcn.com:8090 node installed ocne-control03.lv.vcnf998d566.oraclevcn.com:8090 node installed ocne-worker01.lv.vcnf998d566.oraclevcn.com:8090 node installed ocne-worker02.lv.vcnf998d566.oraclevcn.com:8090 node installed ocne-worker03.lv.vcnf998d566.oraclevcn.com:8090 node installed ocne-worker04.lv.vcnf998d566.oraclevcn.com:8090 node installed ocne-worker05.lv.vcnf998d566.oraclevcn.com:8090 node installed
kubectl 설정
-
kubectl
명령을 설정합니다.-
제어 플레인 노드 중 하나에서 구성 파일을 복사합니다.
mkdir -p $HOME/.kube ssh -o StrictHostKeyChecking=no 10.0.0.150 "sudo cat /etc/kubernetes/admin.conf" > $HOME/.kube/config
예제 출력:
[oracle@ocne-operator ~]$ mkdir -p $HOME/.kube [oracle@ocne-operator ~]$ ssh -o StrictHostKeyChecking=no 10.0.0.150 "sudo cat /etc/kubernetes/admin.conf" > $HOME/.kube/config Warning: Permanently added '10.0.0.150' (ECDSA) to the list of known hosts.
-
kubectl
명령에서 사용할 구성을 내보냅니다.sudo chown $(id -u):$(id -g) $HOME/.kube/config export KUBECONFIG=$HOME/.kube/config echo 'export KUBECONFIG=$HOME/.kube/config' >> $HOME/.bashrc
-
-
kubectl
가 작동하는지 확인합니다.kubectl get nodes
예제 출력:
[oracle@ocne-operator ~]$ kubectl get nodes NAME STATUS ROLES AGE VERSION ocne-control01 Ready control-plane,master 17m v1.23.7+1.el8 ocne-control02 Ready control-plane,master 16m v1.23.7+1.el8 ocne-control03 Ready control-plane,master 15m v1.23.7+1.el8 ocne-worker01 Ready <none> 16m v1.23.7+1.el8 ocne-worker02 Ready <none> 15m v1.23.7+1.el8 ocne-worker03 Ready <none> 14m v1.23.7+1.el8 ocne-worker04 Ready <none> 15m v1.23.7+1.el8 ocne-worker05 Ready <none> 15m v1.23.7+1.el8 [oracle@ocne-operator ~]$
Oracle Cloud Infrastructure Cloud Controller Manager 모듈이 준비되었는지 확인
계속하기 전에 Oracle Cloud Infrastructure Cloud Controller Manager 모듈이 OCI API와 통신할 때까지 기다리는 것이 중요합니다. Oracle Cloud Infrastructure Cloud Controller Manager 모듈은 블록 스토리지 연결과 같은 기능을 처리하는 각 노드에서 포드를 실행합니다. 설치 후 이 컨트롤러는 이 전용 Pod가 초기화되었고 실행 중이며 OCI API와 통신 중임을 확인할 때까지 Pod 일정이 잡히지 않습니다. 이 통신이 성공적으로 설정되기 전까지는 계속하려고 하면 Kubernetes에서 클라우드 스토리지 또는 로드 밸런서를 성공적으로 사용하지 못할 수 있습니다.
-
oci-cloud-controller-manager
Pod 구성요소의 상태를 검색합니다.kubectl -n kube-system get pods -l component=oci-cloud-controller-manager
예제 출력:
[[oracle@ocne-operator ~]$ kubectl -n kube-system get pods -l component=oci-cloud-controller-manager NAME READY STATUS RESTARTS AGE oci-cloud-controller-manager-9d9gh 1/1 Running 1 (48m ago) 50m oci-cloud-controller-manager-jqzs6 1/1 Running 0 50m oci-cloud-controller-manager-xfm9w 1/1 Running 0 50m
-
csi-oci
포드의 롤 상태를 검색합니다.kubectl -n kube-system get pods -l role=csi-oci
예제 출력:
[[oracle@ocne-operator ~]$ kubectl -n kube-system get pods -l role=csi-oci NAME READY STATUS RESTARTS AGE csi-oci-controller-7fcbddd746-2hb5c 4/4 Running 2 (50m ago) 51m csi-oci-node-7jd6t 3/3 Running 0 51m csi-oci-node-fc5x5 3/3 Running 0 51m csi-oci-node-jq8sm 3/3 Running 0 51m csi-oci-node-jqkvl 3/3 Running 0 51m csi-oci-node-jwq8g 3/3 Running 0 51m csi-oci-node-jzxqt 3/3 Running 0 51m csi-oci-node-rmmmb 3/3 Running 0 51m csi-oci-node-zc287 1/3 Running 0 51m
주: 계속 진행하기 전에 이러한 두 명령에서
STATUS
를Running
로 표시할 때까지 기다리십시오.READY
열의 값에 모든 컨테이너가 시작됨으로 표시되지 않고STATUS
열의 값이 15분 후Running
로 표시되지 않는 경우 실습을 재시작하십시오.
(선택사항) 새 Kubernetes 노드 설정
주: 이 섹션의 단계는 실습 초기 배치 중에 이미 완료되었으므로 무료 실습 환경에 필요하지 않습니다. 다음 섹션으로 건너뛰고 계속 진행하십시오.
노드를 확장(추가)할 때 새 노드를 사용하려면 이 자습서의 Prerequisites
섹션에 나열된 모든 필요 조건을 충족해야 합니다.
이 자습서/랩에서 ocne-control04
및 ocne-control05
노드는 새 제어 플레인 노드이고 ocne-worker06
및 ocne-worker07
노드는 새 작업자 노드입니다. 사전 요구사항 외에도 이러한 새 노드는 Oracle Cloud Native Environment 플랫폼 에이전트를 설치하고 사용으로 설정해야 합니다.
-
플랫폼 에이전트를 설치하고 사용으로 설정합니다.
sudo dnf install olcne-agent olcne-utils sudo systemctl enable olcne-agent.service
-
프록시 서버를 사용하는 경우 CRI-O로 구성합니다. 각 Kubernetes 노드에서 CRI-O systemd 구성 디렉토리를 만듭니다. 디렉토리에
proxy.conf
라는 파일을 생성하고 proxy 서버 정보를 추가합니다.sudo mkdir /etc/systemd/system/crio.service.d sudo vi /etc/systemd/system/crio.service.d/proxy.conf
-
예제
proxy.conf
파일을 사용하여 환경의 프록시 값을 적절한 프록시 값으로 대체합니다.[Service] Environment="HTTP_PROXY=proxy.example.com:80" Environment="HTTPS_PROXY=proxy.example.com:80" Environment="NO_PROXY=.example.com,192.0.2.*"
-
docker
또는containerd
서비스가 실행 중인 경우 중지하고 사용 안함으로 설정합니다.sudo systemctl disable --now docker.service sudo systemctl disable --now containerd.service
X.509 개인 CA 인증서 설정
새 제어 플레인 노드와 워커 노드에 대해 X.509 전용 CA 인증서를 설정합니다.
-
새 노드 목록을 생성합니다.
VAR1=$(hostname -d) for NODE in 'ocne-control04' 'ocne-control05' 'ocne-worker06' 'ocne-worker07'; do VAR2+="${NODE}.$VAR1,"; done VAR2=${VAR2%,}
제공된 bash 스크립트는 운영자 노드의 도메인 이름을 확보하고 확장 절차 중 클러스터에 추가할 콤마로 구분된 노드 목록을 만듭니다.
-
새 노드에 대한 개인 CA 및 인증서 집합을 생성합니다.
기존 CA 인증서의 위치를 지정하려면
--byo-ca-cert
옵션을 사용하고, 기존 CA 키의 위치를 지정하려면--byo-ca-key
옵션을 사용합니다.--nodes
옵션을 사용하고 새 제어 플레인 및 워커 노드의 FQDN을 제공합니다.cd /etc/olcne sudo ./gen-certs-helper.sh \ --cert-dir /etc/olcne/configs/certificates/ \ --byo-ca-cert /etc/olcne/configs/certificates/production/ca.cert \ --byo-ca-key /etc/olcne/configs/certificates/production/ca.key \ --nodes $VAR2
예제 출력:
[oracle@ocne-operator ~]$ cd /etc/olcne [oracle@ocne-operator olcne]$ sudo ./gen-certs-helper.sh \ > --cert-dir /etc/olcne/configs/certificates/ \ > --byo-ca-cert /etc/olcne/configs/certificates/production/ca.cert \ > --byo-ca-key /etc/olcne/configs/certificates/production/ca.key \ > --nodes $VAR2 [INFO] Generating certs for ocne-control04.lv.vcnf998d566.oraclevcn.com Generating RSA private key, 2048 bit long modulus (2 primes) .............................+++++ ....................+++++ e is 65537 (0x010001) Signature ok subject=C = US, ST = North Carolina, L = Whynot, O = your-company, OU = private cloud, CN = example.com Getting CA Private Key [INFO] Generating certs for ocne-control05.lv.vcnf998d566.oraclevcn.com Generating RSA private key, 2048 bit long modulus (2 primes) ...+++++ ...........................................................+++++ e is 65537 (0x010001) Signature ok subject=C = US, ST = North Carolina, L = Whynot, O = your-company, OU = private cloud, CN = example.com Getting CA Private Key [INFO] Generating certs for ocne-worker06.lv.vcnf998d566.oraclevcn.com Generating RSA private key, 2048 bit long modulus (2 primes) ......+++++ .......................+++++ e is 65537 (0x010001) Signature ok subject=C = US, ST = North Carolina, L = Whynot, O = your-company, OU = private cloud, CN = example.com Getting CA Private Key [INFO] Generating certs for ocne-worker07.lv.vcnf998d566.oraclevcn.com Generating RSA private key, 2048 bit long modulus (2 primes) ....................................................................................+++++ .................................+++++ e is 65537 (0x010001) Signature ok subject=C = US, ST = North Carolina, L = Whynot, O = your-company, OU = private cloud, CN = example.com Getting CA Private Key ----------------------------------------------------------- Script To Transfer Certs: /etc/olcne/configs/certificates/olcne-tranfer-certs.sh ----------------------------------------------------------- [SUCCESS] Generated certs and file transfer script! [INFO] CA Cert: /etc/olcne/configs/certificates/production/ca.key [INFO] CA Key: /etc/olcne/configs/certificates/production/ca.cert [WARNING] The CA Key is the only way to generate more certificates, ensure it is stored in long term storage [USER STEP #1] Please ensure you have ssh access from this machine to: ocne-control04.lv.vcnf998d566.oraclevcn.com,ocne-control05.lv.vcnf998d566.oraclevcn.com,ocne-worker06.lv.vcnf998d566.oraclevcn.com,ocne-worker07.lv.vcnf998d566.oraclevcn.com
전송 인증서
새로 만든 인증서를 운영자 노드에서 모든 새 노드로 전송합니다.
-
제공된 전송 스크립트에서 사용자 세부정보를 업데이트합니다.
sudo sed -i 's/USER=opc/USER=oracle/g' configs/certificates/olcne-tranfer-certs.sh
주: 스크립트의 기본 사용자는
opc
이므로 자습서에 이 단계가 필요합니다. 이 자습서와 무료 실습 환경은 모두 사용자oracle
를 사용하여 제품을 설치하므로 그에 따라 스크립트 내에서USER
변수를 업데이트합니다. -
인증서 생성 스크립트로 생성된 각 node.key에 대한 권한을 업데이트합니다.
sudo chmod 644 /etc/olcne/configs/certificates/tmp-olcne/ocne-control*/node.key sudo chmod 644 /etc/olcne/configs/certificates/tmp-olcne/ocne-operator*/node.key sudo chmod 644 /etc/olcne/configs/certificates/tmp-olcne/ocne-worker*/node.key
-
새 노드 각각에 인증서를 전송합니다.
주 이 단계에서는 노드 간에 암호가 없는 SSH를 구성해야 합니다. 이 구성은 이 자습서의 범위를 벗어나지만 무료 실습 환경에서 미리 구성됩니다.
bash -ex /etc/olcne/configs/certificates/olcne-tranfer-certs.sh
인증서를 사용하도록 플랫폼 에이전트 구성
이전 단계에서 복사된 인증서를 사용하도록 새 노드마다 플랫폼 에이전트를 구성합니다. 이 작업은 ssh
에 대해 명령을 실행하여 운영자 노드에서 수행합니다.
-
ocne-control04 노드를 구성합니다.
ssh -o StrictHostKeyChecking=no ocne-control04 'sudo /etc/olcne/bootstrap-olcne.sh \ --secret-manager-type file \ --olcne-node-cert-path /etc/olcne/configs/certificates/production/node.cert \ --olcne-ca-path /etc/olcne/configs/certificates/production/ca.cert \ --olcne-node-key-path /etc/olcne/configs/certificates/production/node.key \ --olcne-component agent'
예제 출력:
[oracle@ocne-operator olcne]$ ssh -o StrictHostKeyChecking=no ocne-control04 'sudo /etc/olcne/bootstrap-olcne.sh \ > --secret-manager-type file \ > --olcne-node-cert-path /etc/olcne/configs/certificates/production/node.cert \ > --olcne-ca-path /etc/olcne/configs/certificates/production/ca.cert \ > --olcne-node-key-path /etc/olcne/configs/certificates/production/node.key \ > --olcne-component agent' Warning: Permanently added 'ocne-control04,10.0.0.153' (ECDSA) to the list of known hosts. ��� olcne-agent.service - Agent for Oracle Linux Cloud Native Environments Loaded: loaded (/usr/lib/systemd/system/olcne-agent.service; enabled; vendor preset: disabled) Drop-In: /etc/systemd/system/olcne-agent.service.d ������10-auth.conf Active: active (running) since Tue 2022-08-30 15:29:37 GMT; 2s ago Main PID: 152809 (olcne-agent) Tasks: 8 (limit: 202294) Memory: 11.1M CGroup: /system.slice/olcne-agent.service ������152809 /usr/libexec/olcne-agent --secret-manager-type file --olcne-ca-path /etc/olcne/configs/certificates/production/ca.cert --olcne-node-cert-path /etc/olcne/configs/certificates/production/node.cert --olcne-node-key-path /etc/olcne/configs/certificates/production/node.key Aug 30 15:29:37 ocne-control04 systemd[1]: Started Agent for Oracle Linux Cloud Native Environments. Aug 30 15:29:37 ocne-control04 olcne-agent[152809]: time=30/08/22 15:29:37 level=info msg=Started server on[::]:8090
-
ocne-control05 노드를 구성합니다.
ssh -o StrictHostKeyChecking=no ocne-control05 'sudo /etc/olcne/bootstrap-olcne.sh \ --secret-manager-type file \ --olcne-node-cert-path /etc/olcne/configs/certificates/production/node.cert \ --olcne-ca-path /etc/olcne/configs/certificates/production/ca.cert \ --olcne-node-key-path /etc/olcne/configs/certificates/production/node.key \ --olcne-component agent'
예제 출력:
[oracle@ocne-operator olcne]$ ssh -o StrictHostKeyChecking=no ocne-control05 'sudo /etc/olcne/bootstrap-olcne.sh \ > --secret-manager-type file \ > --olcne-node-cert-path /etc/olcne/configs/certificates/production/node.cert \ > --olcne-ca-path /etc/olcne/configs/certificates/production/ca.cert \ > --olcne-node-key-path /etc/olcne/configs/certificates/production/node.key \ > --olcne-component agent' Warning: Permanently added 'ocne-control05,10.0.0.154' (ECDSA) to the list of known hosts. ��� olcne-agent.service - Agent for Oracle Linux Cloud Native Environments Loaded: loaded (/usr/lib/systemd/system/olcne-agent.service; enabled; vendor preset: disabled) Drop-In: /etc/systemd/system/olcne-agent.service.d ������10-auth.conf Active: active (running) since Tue 2022-08-30 15:34:13 GMT; 2s ago Main PID: 153413 (olcne-agent) Tasks: 7 (limit: 202294) Memory: 9.1M CGroup: /system.slice/olcne-agent.service ������153413 /usr/libexec/olcne-agent --secret-manager-type file --olcne-ca-path /etc/olcne/configs/certificates/production/ca.cert --olcne-node-cert-path /etc/olcne/configs/certificates/production/node.cert --olcne-node-key-path /etc/olcne/configs/certificates/production/node.key Aug 30 15:34:13 ocne-control05 systemd[1]: olcne-agent.service: Succeeded. Aug 30 15:34:13 ocne-control05 systemd[1]: Stopped Agent for Oracle Linux Cloud Native Environments. Aug 30 15:34:13 ocne-control05 systemd[1]: Started Agent for Oracle Linux Cloud Native Environments. Aug 30 15:34:13 ocne-control05 olcne-agent[153413]: time=30/08/22 15:34:13 level=info msg=Started server on[::]:8090
-
ocne-worker06 노드를 구성합니다.
ssh -o StrictHostKeyChecking=no ocne-worker06 'sudo /etc/olcne/bootstrap-olcne.sh \ --secret-manager-type file \ --olcne-node-cert-path /etc/olcne/configs/certificates/production/node.cert \ --olcne-ca-path /etc/olcne/configs/certificates/production/ca.cert \ --olcne-node-key-path /etc/olcne/configs/certificates/production/node.key \ --olcne-component agent'
예제 출력:
[oracle@ocne-operator olcne]$ ssh -o StrictHostKeyChecking=no ocne-worker06 'sudo /etc/olcne/bootstrap-olcne.sh \ > --secret-manager-type file \ > --olcne-node-cert-path /etc/olcne/configs/certificates/production/node.cert \ > --olcne-ca-path /etc/olcne/configs/certificates/production/ca.cert \ > --olcne-node-key-path /etc/olcne/configs/certificates/production/node.key \ > --olcne-component agent' Warning: Permanently added 'ocne-worker06,10.0.0.165' (ECDSA) to the list of known hosts. ��� olcne-agent.service - Agent for Oracle Linux Cloud Native Environments Loaded: loaded (/usr/lib/systemd/system/olcne-agent.service; enabled; vendor preset: disabled) Drop-In: /etc/systemd/system/olcne-agent.service.d ������10-auth.conf Active: active (running) since Tue 2022-08-30 15:41:08 GMT; 2s ago Main PID: 153988 (olcne-agent) Tasks: 8 (limit: 202294) Memory: 5.2M CGroup: /system.slice/olcne-agent.service ������153988 /usr/libexec/olcne-agent --secret-manager-type file --olcne-ca-path /etc/olcne/configs/certificates/production/ca.cert --olcne-node-cert-path /etc/olcne/configs/certificates/production/node.cert --olcne-node-key-path /etc/olcne/configs/certificates/production/node.key Aug 30 15:41:08 ocne-worker06 systemd[1]: Started Agent for Oracle Linux Cloud Native Environments. Aug 30 15:41:08 ocne-worker06 olcne-agent[153988]: time=30/08/22 15:41:08 level=info msg=Started server on[::]:8090
-
ocne-worker07 노드를 구성합니다.
ssh -o StrictHostKeyChecking=no ocne-worker07 'sudo /etc/olcne/bootstrap-olcne.sh \ --secret-manager-type file \ --olcne-node-cert-path /etc/olcne/configs/certificates/production/node.cert \ --olcne-ca-path /etc/olcne/configs/certificates/production/ca.cert \ --olcne-node-key-path /etc/olcne/configs/certificates/production/node.key \ --olcne-component agent'
예제 출력:
[oracle@ocne-operator olcne]$ ssh -o StrictHostKeyChecking=no ocne-worker07 'sudo /etc/olcne/bootstrap-olcne.sh \ > --secret-manager-type file \ > --olcne-node-cert-path /etc/olcne/configs/certificates/production/node.cert \ > --olcne-ca-path /etc/olcne/configs/certificates/production/ca.cert \ > --olcne-node-key-path /etc/olcne/configs/certificates/production/node.key \ > --olcne-component agent' Warning: Permanently added 'ocne-worker07,10.0.0.166' (ECDSA) to the list of known hosts. ��� olcne-agent.service - Agent for Oracle Linux Cloud Native Environments Loaded: loaded (/usr/lib/systemd/system/olcne-agent.service; enabled; vendor preset: disabled) Drop-In: /etc/systemd/system/olcne-agent.service.d ������10-auth.conf Active: active (running) since Tue 2022-08-30 15:43:23 GMT; 2s ago Main PID: 154734 (olcne-agent) Tasks: 8 (limit: 202294) Memory: 9.1M CGroup: /system.slice/olcne-agent.service ������154734 /usr/libexec/olcne-agent --secret-manager-type file --olcne-ca-path /etc/olcne/configs/certificates/production/ca.cert --olcne-node-cert-path /etc/olcne/configs/certificates/production/node.cert --olcne-node-key-path /etc/olcne/configs/certificates/production/node.key Aug 30 15:43:23 ocne-worker07 systemd[1]: olcne-agent.service: Succeeded. Aug 30 15:43:23 ocne-worker07 systemd[1]: Stopped Agent for Oracle Linux Cloud Native Environments. Aug 30 15:43:23 ocne-worker07 systemd[1]: Started Agent for Oracle Linux Cloud Native Environments. Aug 30 15:43:23 ocne-worker07 olcne-agent[154734]: time=30/08/22 15:43:23 level=info msg=Started server on[::]:8090
OCI 로드 밸런서 액세스 및 백엔드 보기
Kubernetes 컨트롤 플레인에 대해 둘 이상의 노드를 정의하려면 로드 밸런서가 필요하므로 무료 실습 환경이 배포될 때 자동으로 설정된 구성을 확인하는 것이 좋습니다. 그러면 연습을 생성할 때 배치 및 구성된 세 개의 노드가 Healthy
상태로 표시되고, 다가오는 단계에서 Critical
상태로 추가될 두 개의 노드가 표시됩니다.
-
터미널에서 Luna 데스크탑으로 전환
-
Luna Lab 아이콘을 사용하여 Luna Lab 세부정보 페이지를 엽니다.
-
OCI 콘솔 링크를 누릅니다.
-
Oracle Cloud 콘솔 로그인 페이지가 표시됩니다.
-
User Name
및Password
를 입력합니다(인증서 섹션의 Luna Lab 탭에 있음). -
햄버거 메뉴(왼쪽 위)와 Networking 및 Load Balancers를 차례로 누릅니다.
-
로드 밸런서 페이지가 표시됩니다.
-
드롭다운 목록에서 사용 중인 구획을 찾습니다.
-
테이블(ocne-load-balancer)에 나열된 로드 밸런서를 누릅니다.
-
페이지를 아래로 스크롤하고 리소스 섹션의 왼쪽에 있는 백엔드 집합 링크를 누릅니다.
-
백엔드 집합 테이블이 표시됩니다. 이름 열에서 ocne-lb-backend-set라는 링크를 누릅니다.
-
리소스 섹션의 왼쪽에 있는 백엔드 링크를 누릅니다.
-
제어 플레인 노드를 나타내는 백엔드가 표시됩니다.
참고 두 개의 백엔드 노드는 아직 Kubernetes 컨트롤 플레인 클러스터의 일부가 아니기 때문에 Critical - connection failed 상태입니다. 확장 단계를 완료한 후 백엔드 노드의 상태를 다시 확인할 것이므로, 이 브라우저 탭을 열린 상태로 유지합니다.
Kubernetes 노드 보기
클러스터에서 현재 사용 가능한 Kubernetes 노드를 확인합니다. 제어 플레인 노드 3개와 작업자 노드 5개가 있습니다.
-
노드가 모두 READY 상태인지 확인합니다.
kubectl get nodes
예제 출력:
[oracle@ocne-operator olcne]$ kubectl get nodes NAME STATUS ROLES AGE VERSION ocne-control01 Ready control-plane,master 5h15m v1.23.7+1.el8 ocne-control02 Ready control-plane,master 5h14m v1.23.7+1.el8 ocne-control03 Ready control-plane,master 5h13m v1.23.7+1.el8 ocne-worker01 Ready <none> 5h14m v1.23.7+1.el8 ocne-worker02 Ready <none> 5h13m v1.23.7+1.el8 ocne-worker03 Ready <none> 5h12m v1.23.7+1.el8 ocne-worker04 Ready <none> 5h13m v1.23.7+1.el8 ocne-worker05 Ready <none> 5h14m v1.23.7+1.el8
배치 구성 파일에 제어 플레인 및 워커 노드 추가
클러스터에 추가할 모든 제어 플레인 및 작업자 노드에 FQDN(정규화된 도메인 이름) 및 플랫폼 에이전트 액세스 포트(8090)를 추가합니다.
새 클러스터 노드를 포함하도록 YAML 배치 구성 파일을 편집합니다. worker-node
섹션에 작업자 노드를 추가하는 동안 master-nodes
섹션 아래에 제어 플레인 노드를 추가합니다.
이 자습서에서 구성 파일에 대한 파일 이름은 myenvironment.yaml
이며, 현재 제어 플레인 3개와 작업자 노드 5개가 포함되어 있습니다.
-
현재 환경에서 3개의 제어 플레인 노드와 5개의 워커 노드를 사용하는지 확인합니다.
cat ~/myenvironment.yaml
예제 출력:
... master-nodes: - ocne-control01.lv.vcneea798df.oraclevcn.com:8090 - ocne-control02.lv.vcneea798df.oraclevcn.com:8090 - ocne-control03.lv.vcneea798df.oraclevcn.com:8090 worker-nodes: - ocne-worker01.lv.vcneea798df.oraclevcn.com:8090 - ocne-worker02.lv.vcneea798df.oraclevcn.com:8090 - ocne-worker03.lv.vcneea798df.oraclevcn.com:8090 - ocne-worker04.lv.vcneea798df.oraclevcn.com:8090 - ocne-worker05.lv.vcneea798df.oraclevcn.com:8090 ...
-
myenvironment.yaml
파일에 새 제어 플레인 및 워커 노드를 추가합니다.cd ~ sed -i '19 i \ - ocne-control04.'"$(hostname -d)"':8090' ~/myenvironment.yaml sed -i '20 i \ - ocne-control05.'"$(hostname -d)"':8090' ~/myenvironment.yaml sed -i '27 i \ - ocne-worker06.'"$(hostname -d)"':8090' ~/myenvironment.yaml sed -i '28 i \ - ocne-worker07.'"$(hostname -d)"':8090' ~/myenvironment.yaml
-
제어 플레인 및 워커 노드가
myenvironment.yaml
파일에 추가되었는지 확인합니다.cat ~/myenvironment.yaml
발췌 부분 예:
... master-nodes: - ocne-control01.lv.vcneea798df.oraclevcn.com:8090 - ocne-control02.lv.vcneea798df.oraclevcn.com:8090 - ocne-control03.lv.vcneea798df.oraclevcn.com:8090 - ocne-control04.lv.vcneea798df.oraclevcn.com:8090 - ocne-control05.lv.vcneea798df.oraclevcn.com:8090 worker-nodes: - ocne-worker01.lv.vcneea798df.oraclevcn.com:8090 - ocne-worker02.lv.vcneea798df.oraclevcn.com:8090 - ocne-worker03.lv.vcneea798df.oraclevcn.com:8090 - ocne-worker04.lv.vcneea798df.oraclevcn.com:8090 - ocne-worker05.lv.vcneea798df.oraclevcn.com:8090 - ocne-worker06.lv.vcneea798df.oraclevcn.com:8090 - ocne-worker07.lv.vcneea798df.oraclevcn.com:8090 ...
이제 구성 파일에 새 제어 플레인 노드(ocne-control04
및 ocne-control05
)와 새 워커 노드(ocne-worker06
및 ocne-worker07
)가 포함됩니다. 이는 확장이 완료된 후 클러스터에 있어야 하는 모든 제어 플레인 및 워커 노드를 나타냅니다.
제어 플레인 및 워커 노드 스케일 업
-
모듈 update 명령을 실행합니다.
olcnectl module update
명령을--config-file
옵션과 함께 사용하여 구성 파일의 위치를 지정합니다. 플랫폼 API 서버는 클러스터의 상태로 구성 파일을 검증하고 클러스터에 추가해야 하는 노드가 더 있음을 인식합니다. 메시지가 표시되면y
에 응답합니다.주: 각 모듈이 업데이트되는 동안 터미널 창의 프롬프트 간에는 지연이 발생합니다. 무료 실습 환경에서 이 지연 시간은 최대 10-15분입니다.
olcnectl module update --config-file myenvironment.yaml
예제 출력:
[oracle@ocne-operator ~]$ olcnectl module update --config-file myenvironment.yaml ? [WARNING] Update will shift your workload and some pods will lose data if they rely on local storage. Do you want to continue? Yes Taking backup of modules before update Backup of modules succeeded. Updating modules Update successful ? [WARNING] Update will shift your workload and some pods will lose data if they rely on local storage. Do you want to continue? Yes Taking backup of modules before update Backup of modules succeeded. Updating modules Update successful ? [WARNING] Update will shift your workload and some pods will lose data if they rely on local storage. Do you want to continue? Yes Taking backup of modules before update Backup of modules succeeded. Updating modules Update successful
-
(클라우드 콘솔) 로드 밸런서의 백엔드 집합에 5개의 정상 백엔드 노드가 표시되는지 확인합니다.
-
새 제어 플레인 및 작업자 노드가 클러스터에 추가되었는지 확인합니다.
kubectl get nodes
예제 출력:
[oracle@ocne-operator ~]$ kubectl get nodes NAME STATUS ROLES AGE VERSION ocne-control01 Ready control-plane,master 99m v1.23.7+1.el8 ocne-control02 Ready control-plane,master 97m v1.23.7+1.el8 ocne-control03 Ready control-plane,master 96m v1.23.7+1.el8 ocne-control04 Ready control-plane,master 13m v1.23.7+1.el8 ocne-control05 Ready control-plane,master 12m v1.23.7+1.el8 ocne-worker01 Ready <none> 99m v1.23.7+1.el8 ocne-worker02 Ready <none> 98m v1.23.7+1.el8 ocne-worker03 Ready <none> 98m v1.23.7+1.el8 ocne-worker04 Ready <none> 98m v1.23.7+1.el8 ocne-worker05 Ready <none> 98m v1.23.7+1.el8 ocne-worker06 Ready <none> 13m v1.23.7+1.el8 ocne-worker07 Ready <none> 13m v1.23.7+1.el8
이제 새 제어 플레인 노드(
ocne-control04
및ocne-control05
)와 새 워커 노드(ocne-work06
및ocne-worker07
)가 클러스터에 포함됩니다. 따라서 스케일 업 작업이 작동하는지 확인합니다.
제어 평면 노드 축소
제어 플레인 및 작업자 노드가 독립적으로 확장될 수 있음을 보여주기 위해 이 단계에서 제어 플레인 노드를 축소(제거)합니다.
-
현재 환경에서 5개의 제어 플레인 노드와 7개의 워커 노드를 사용하는지 확인합니다.
cat ~/myenvironment.yaml
예제 출력:
... master-nodes: - ocne-control01.lv.vcneea798df.oraclevcn.com:8090 - ocne-control02.lv.vcneea798df.oraclevcn.com:8090 - ocne-control03.lv.vcneea798df.oraclevcn.com:8090 - ocne-control04.lv.vcneea798df.oraclevcn.com:8090 - ocne-control05.lv.vcneea798df.oraclevcn.com:8090 worker-nodes: - ocne-worker01.lv.vcneea798df.oraclevcn.com:8090 - ocne-worker02.lv.vcneea798df.oraclevcn.com:8090 - ocne-worker03.lv.vcneea798df.oraclevcn.com:8090 - ocne-worker04.lv.vcneea798df.oraclevcn.com:8090 - ocne-worker05.lv.vcneea798df.oraclevcn.com:8090 - ocne-worker06.lv.vcneea798df.oraclevcn.com:8090 - ocne-worker07.lv.vcneea798df.oraclevcn.com:8090 ...
-
클러스터를 원래의 세 컨트롤 플레인으로 다시 스케일 다운하려면 구성 파일에서
ocne-control04
및ocne-control05
컨트롤 플레인 노드를 제거합니다.sed -i '19d;20d' ~/myenvironment.yaml
-
구성 파일에 제어 플레인 노드 3개와 작업자 노드 7개만 포함되어 있는지 확인합니다.
cat ~/myenvironment.yaml
발췌 부분 예:
... master-nodes: - ocne-control01.lv.vcneea798df.oraclevcn.com:8090 - ocne-control02.lv.vcneea798df.oraclevcn.com:8090 - ocne-control03.lv.vcneea798df.oraclevcn.com:8090 worker-nodes: - ocne-worker01.lv.vcneea798df.oraclevcn.com:8090 - ocne-worker02.lv.vcneea798df.oraclevcn.com:8090 - ocne-worker03.lv.vcneea798df.oraclevcn.com:8090 - ocne-worker04.lv.vcneea798df.oraclevcn.com:8090 - ocne-worker05.lv.vcneea798df.oraclevcn.com:8090 - ocne-worker06.lv.vcneea798df.oraclevcn.com:8090 - ocne-worker07.lv.vcneea798df.oraclevcn.com:8090 ...
-
모듈 업데이트 경고 메시지를 숨깁니다.
구성 파일에
force: true
지시어를 추가하여 모듈 업데이트 중 확인 프롬프트를 표시하지 않고 숨길 수 있습니다. 이directive
는 정의된 각 모듈에 대해name: <xxxx>
지시어 바로 아래에 배치되어야 합니다.cd ~ sed -i '12 i \ force: true' ~/myenvironment.yaml sed -i '35 i \ force: true' ~/myenvironment.yaml sed -i '40 i \ force: true' ~/myenvironment.yaml
-
이제 구성 파일에
force: true
지시어가 포함되어 있는지 확인합니다.cat ~/myenvironment.yaml
발췌 부분 예:
[oracle@ocne-operator ~]$ cat ~/myenvironment.yaml environments: - environment-name: myenvironment globals: api-server: 127.0.0.1:8091 secret-manager-type: file olcne-ca-path: /etc/olcne/configs/certificates/production/ca.cert olcne-node-cert-path: /etc/olcne/configs/certificates/production/node.cert olcne-node-key-path: /etc/olcne/configs/certificates/production/node.key modules: - module: kubernetes name: mycluster force: true args: container-registry: container-registry.oracle.com/olcne load-balancer: 10.0.0.18:6443 master-nodes: - ocne-control01.lv.vcn1174e41d.oraclevcn.com:8090 - ocne-control02.lv.vcn1174e41d.oraclevcn.com:8090 - ocne-control03.lv.vcn1174e41d.oraclevcn.com:8090 worker-nodes: - ocne-worker01.lv.vcn1174e41d.oraclevcn.com:8090 - ocne-worker02.lv.vcn1174e41d.oraclevcn.com:8090 - ocne-worker03.lv.vcn1174e41d.oraclevcn.com:8090 - ocne-worker04.lv.vcn1174e41d.oraclevcn.com:8090 - ocne-worker05.lv.vcn1174e41d.oraclevcn.com:8090 - ocne-worker06.lv.vcneea798df.oraclevcn.com:8090 - ocne-worker07.lv.vcneea798df.oraclevcn.com:8090 selinux: enforcing restrict-service-externalip: true restrict-service-externalip-ca-cert: /etc/olcne/configs/certificates/restrict_external_ip/production/ca.cert restrict-service-externalip-tls-cert: /etc/olcne/configs/certificates/restrict_external_ip/production/node.cert restrict-service-externalip-tls-key: /etc/olcne/configs/certificates/restrict_external_ip/production/node.key - module: helm name: myhelm force: true args: helm-kubernetes-module: mycluster - module: oci-ccm name: myoci force: true oci-ccm-helm-module: myhelm oci-use-instance-principals: true oci-compartment: ocid1.compartment.oc1..aaaaaaaanr6cysadeswwxc7sczdsrlamzhfh6scdyvuh4s4fmvecob6e2cha oci-vcn: ocid1.vcn.oc1.eu-frankfurt-1.amaaaaaag7acy3iat3duvrym376oax7nxdyqd56mqxtjaws47t4g7vqthgja oci-lb-subnet1: ocid1.subnet.oc1.eu-frankfurt-1.aaaaaaaa6rt6chugbkfhyjyl4exznpxrlvnus2bgkzcgm7fljfkqbxkva6ya
-
클러스터를 업데이트하고 노드를 제거하는 명령을 실행합니다.
주: 이 작업을 완료하는 데 몇 분 정도 걸릴 수 있습니다.
olcnectl module update --config-file myenvironment.yaml
예제 출력:
[oracle@ocne-operator ~]$ olcnectl module update --config-file myenvironment.yaml Taking backup of modules before update Backup of modules succeeded. Updating modules Update successful Taking backup of modules before update Backup of modules succeeded. Updating modules Update successful Taking backup of modules before update Backup of modules succeeded. Updating modules Update successful
-
(클라우드 콘솔) 로드 밸런서의 백엔드 집합에 3개의 정상(
Health = 'OK'
) 노드와 2개의 비정상(Health = 'Critical - Connection failed'
) 노드가 표시되는지 확인합니다. 두 노드가 Kubernetes 클러스터에서 제거되었기 때문에 위기 상태로 표시되는 이유입니다. -
플랫폼 API 서버가 클러스터에서 제거한 제어 플레인 노드를 보여줍니다. 제어 플레인(
ocne-control04
및ocne-control05
) 노드가 제거되었는지 확인합니다.kubectl get nodes
예제 출력:
[oracle@ocne-operator ~]$ kubectl get nodes NAME STATUS ROLES AGE VERSION ocne-control01 Ready control-plane,master 164m v1.23.7+1.el8 ocne-control02 Ready control-plane,master 163m v1.23.7+1.el8 ocne-control03 Ready control-plane,master 162m v1.23.7+1.el8 ocne-worker01 Ready <none> 164m v1.23.7+1.el8 ocne-worker02 Ready <none> 163m v1.23.7+1.el8 ocne-worker03 Ready <none> 164m v1.23.7+1.el8 ocne-worker04 Ready <none> 164m v1.23.7+1.el8 ocne-worker05 Ready <none> 164m v1.23.7+1.el8 ocne-worker06 Ready <none> 13m v1.23.7+1.el8 ocne-worker07 Ready <none> 13m v1.23.7+1.el8
요약
이렇게 해서 클러스터에서 Kubernetes 노드를 추가한 다음 제거하는 방법이 자세히 설명된 데모가 완료되었습니다. 이 연습에서는 제어 플레인 및 작업자 노드를 동시에 업데이트하는 방법을 설명했지만 Oracle Cloud Native Environment Kubernetes 클러스터를 확대 또는 축소하는 권장 접근 방식이 아니며, 프로덕션 환경에서는 이를 별도로 수행할 가능성이 높습니다.
추가 정보
추가 학습 자원
docs.oracle.com/learn에서 다른 실습을 찾아보거나 Oracle Learning YouTube channel에서 무료 학습 콘텐츠에 액세스할 수 있습니다. 또한 education.oracle.com/learning-explorer를 방문하여 Oracle Learning Explorer로 변경하십시오.
제품 설명서는 Oracle Help Center를 참조하십시오.
Scale a Kubernetes Cluster on Oracle Cloud Native Environment
F30806-12
September 2022
Copyright © 2022, Oracle and/or its affiliates.