참고:
- 이 사용지침서에서는 Oracle Cloud에 접근해야 합니다. 무료 계정에 등록하려면 Oracle Cloud Infrastructure Free Tier 시작하기를 참조하십시오.
- Oracle Cloud Infrastructure 인증서, 테넌시 및 구획에 대한 예제 값을 사용합니다. 실습을 완료하면 이러한 값을 클라우드 환경에 고유한 값으로 대체합니다.
Velero를 사용하여 Azure Kubernetes 서비스 클러스터 또는 Amazon EKS 클러스터를 Container Engine for Kubernetes로 마이그레이션
소개
Velero는 안전한 백업 및 복원, 재해 복구 수행, Kubernetes 클러스터 리소스 및 영구 볼륨 마이그레이션을 위한 오픈 소스 도구입니다. OCI(Oracle Cloud Infrastructure) Object Storage는 S3-Compatible이므로 Velero의 AWS 플러그인을 사용할 수 있습니다. 이 자습서에서는 Azure Kubernetes Service(AKS)를 사용하지만 Amazon Elastic Kubernetes Service(Amazon EKS)에서도 단계가 원활하게 작동합니다.
다음 다이어그램은 프로세스 작동 방식에 대한 개요입니다.
이 자습서에서는 영구적 볼륨 클레임과 여기에 사용자 정의 index.html
파일 및 더미 비밀이 부착된 NGINX Pod를 준비했습니다.
> kubectl get pods --n nginx
NAME READY STATUS RESTARTS AGE
task-pv-pod 1/1 Running 0 47h
> kubectl exec -it task-pv-pod --n nginx -- curl localhost
AKS to OKE Migration with PVC attached
>kubectl get secrets --namespace nginx
NAME TYPE DATA AGE
okemigration Opaque 1 2s
목표
- 오브젝트 스토리지 버킷 S3 끝점과 함께 사용할 고객 암호 키를 생성합니다.
- AKS 및 OKE(Oracle Cloud Infrastructure Container Engine for Kubernetes)에서 Velero를 설정하십시오.
- 백업 및 복원을 수행하여 Kubernetes 네임스페이스를 OKE로 이전합니다.
필요 조건
- Kubernetes에 대한 중간 지식.
- 백업 지점으로 사용될 오브젝트 스토리지 버킷입니다.
- 오브젝트 스토리지 버킷의 읽기/쓰기 사용자 권한입니다.
- Kubernetes 클러스터 또는 Microsoft Azure와 OCI의 Cloud Shell 내부에 연결하는 데 사용하는 컴퓨터의 Velero 바이너리입니다.
작업 1: 내부에 고객 암호 키를 사용하여 velero-credentials
파일 생성
-
고객 암호 키가 없는 경우 이 단계를 따르십시오.
-
AKS/EKS 및 OKE 클러스터(또는 Cloud Shell)에 액세스하는 데 사용하는 시스템에서 다음 컨텐츠를 사용하여
velero-credentials
파일을 만듭니다.[default] aws_access_key_id=<<Access Key ID>> aws_secret_access_key=<<Generated Key>>
작업 2: Velero 다운로드 및 설치
-
이 단계에 따라 클러스터에 액세스하는 데 사용할 시스템에 Velero를 설치하거나 Cloud Shell을 사용 중인 경우 여기에서 다운로드하십시오.
-
다음 명령을 사용하여 AKS 및 OKE 클러스터 모두에 Velero를 설치합니다.
주: 이진을 다운로드한 경우 처음부터 ./를 사용하여 velero를 실행합니다.
velero install \ --provider aws \ --bucket <<Bucket name>> \ --prefix <<Tenancy name>> \ --use-volume-snapshots=false \ --plugins velero/velero-plugin-for-aws:v1.6.0 \ --secret-file <<Location of the file created with the customer secret key>> \ --backup-location-config region=<<Region>>,s3ForcePathStyle="true",s3Url=https://<<tenancy name>>.compat.objectstorage.<<region>>.oraclecloud.com \ --use-node-agent
-
다음 명령을 실행하여 Velero가 AKS 및 OKE에 설치되었는지 확인합니다.
> kubectl get deployment -n velero NAME READY UP-TO-DATE AVAILABLE AGE velero 1/1 1 1 47h
작업 3: 클러스터 백업
-
AKS 클러스터에서 다음 명령을 실행합니다. 이 자습서에서는 다운로드한 velero 바이너리와 함께 Azure CLI를 사용합니다.
velero-v1.11.1-rc.1-linux-amd64> ./velero backup create nginxoke --include-namespaces nginx --default-volumes-to-fs-backup Backup request "nginxoke" submitted successfully. Run `velero backup describe nginxoke` or `velero backup logs nginxoke` for more details.
-
클러스터가 백업되었는지 확인합니다.
velero-v1.11.1-rc.1-linux-amd64> ./velero backup describe nginxoke Name: nginxoke Namespace: velero Labels: velero.io/storage-location=default Annotations: velero.io/source-cluster-k8s-gitversion=v1.24.10 velero.io/source-cluster-k8s-major-version=1 velero.io/source-cluster-k8s-minor-version=24 Phase: Completed Namespaces: Included: nginx Excluded: <none> ................. You can also check the Object Storage Bucket: 
작업 4: OKE로 복원 또는 이전
-
AKS, EKS 및 OKE는 영구 볼륨 클레임에 서로 다른
storageClassNames
를 사용하므로storageClassNames
소스를 OCI 호환 클래스 이름으로 변환하는 configMap를 만들어야 합니다. 이렇게 하려면 다음 내용으로configMap.yaml
파일을 만듭니다. 소스storageClassName
에 맞게 조정합니다.중요: 1단계를 완료해야 합니다. 그렇지 않으면 Pod가 보류 중 상태로 유지됩니다.
apiVersion: v1 kind: ConfigMap metadata: # any name can be used; Velero uses the labels (below) # to identify it rather than the name name: change-storage-class-config # must be in the velero namespace namespace: velero # the below labels should be used verbatim in your # ConfigMap. labels: # this value-less label identifies the ConfigMap as # config for a plugin (i.e. the built-in change storage # class restore item action plugin) velero.io/plugin-config: "" # this label identifies the name and kind of plugin # that this ConfigMap is for. velero.io/change-storage-class: RestoreItemAction data: # add 1+ key-value pairs here, where the key is the old # storage class name and the value is the new storage # class name. <old-storage-class>: oci-bv
-
다음 명령을 사용하여 OKE 클러스터에 configMap를 적용합니다.
kubectl apply -f configMap.yaml
-
OKE 클러스터가 오브젝트 스토리지의 백업에 액세스할 수 있는지 확인합니다.
$ velero get backup NAME STATUS ERRORS WARNINGS CREATED EXPIRES STORAGE LOCATION SELECTOR nginxoke Completed 0 0 2023-07-22 14:40:33 +0300 EEST 29d default <none>
-
다음 명령을 사용하여 복원을 만듭니다.
$ velero restore create --from-backup nginxoke Restore request "nginxoke-20230722145553" submitted successfully. Run `velero restore describe nginxoke-20230722145553` or `velero restore logs nginxoke-20230722145553` for more details.
-
복원 상태를 확인합니다.
$ velero restore describe nginxoke-20230722145553 Name: nginxoke-20230722145553 Namespace: velero Labels: <none> Annotations: <none> Phase: Completed Total items to be restored: 7 Items restored: 7 Started: 2023-07-22 14:55:54 +0300 EEST Completed: 2023-07-22 14:56:45 +0300 EEST ..........
-
클러스터가 성공적으로 마이그레이션되었는지 확인합니다.
$ kubectl get pod -n nginx NAME READY STATUS RESTARTS AGE task-pv-pod 1/1 Running 0 2m15s $ kubectl get secrets -n nginx NAME TYPE DATA AGE okemigration Opaque 1 2m21s $ kubectl get pvc -n nginx NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE task-pv-claim Bound csi-d03267f7-32cf-4068-8809-d29aa649dcba 50Gi RWO oci-bv 2m31s $ kubectl exec task-pv-pod -n nginx -- curl http://localhost AKS to OKE Migration with PVC attached
관련 링크
수락
- Guido Alejandro Ferreyra(Principal Cloud Architect)
추가 학습 자원
docs.oracle.com/learn에서 다른 실습을 살펴보거나 Oracle Learning YouTube 채널에서 더 많은 무료 학습 콘텐츠에 액세스하십시오. 또한 Oracle Learning Explorer가 되려면 education.oracle.com/learning-explorer를 방문하십시오.
제품 설명서는 Oracle Help Center를 참조하십시오.
Migrate your Azure Kubernetes Service Cluster or Amazon EKS Cluster to Container Engine for Kubernetes using Velero
F84712-01
August 2023
Copyright © 2023, Oracle and/or its affiliates.