1장. Operator를 사용하여 업그레이드
RHACS(Advanced Cluster Security for Kubernetes) Operator를 통한 업그레이드는 설치 시 선택한 업데이트 승인 옵션에 따라 자동으로 또는 수동으로 수행됩니다.
Operator를 사용하여 RHACS를 설치하고 Update 승인 필드에서 자동 을 선택하면 새 소프트웨어 버전이 릴리스될 때 RHACS가 자동으로 업데이트됩니다. 수동 을 선택한 경우 OLM(Operator Lifecycle Manager)을 사용하여 후속 Operator 업데이트를 승인해야 합니다. 자세한 내용은 보류 중인 Operator 업데이트 수동 승인을 참조하십시오.
Operator 업그레이드를 롤백하려면 다음 섹션 중 하나에 설명된 단계를 수행해야 합니다. CLI 또는 OpenShift Container Platform 웹 콘솔을 사용하여 Operator 업그레이드를 롤백할 수 있습니다.
1.1. CLI를 사용하여 Operator 업그레이드 롤백
CLI 명령을 사용하여 Operator 버전을 롤백할 수 있습니다.
절차
다음 명령을 실행하여 OLM 서브스크립션을 삭제합니다.
OpenShift Container Platform의 경우 다음 명령을 실행합니다.
$ oc -n rhacs-operator delete subscription rhacs-operator
Kubernetes의 경우 다음 명령을 실행합니다.
$ kubectl -n rhacs-operator delete subscription rhacs-operator
다음 명령을 실행하여 CSV(클러스터 서비스 버전)를 삭제합니다.
OpenShift Container Platform의 경우 다음 명령을 실행합니다.
$ oc -n rhacs-operator delete csv -l operators.coreos.com/rhacs-operator.rhacs-operator
Kubernetes의 경우 다음 명령을 실행합니다.
$ kubectl -n rhacs-operator delete csv -l operators.coreos.com/rhacs-operator.rhacs-operator
다음 옵션 중 하나를 선택하여 롤백할 이전 버전을 결정합니다.
현재 Central 인스턴스가 실행 중인 경우 RHACS API를 쿼리하여 다음 명령을 실행하여 롤백 버전을 가져옵니다.
$ curl -k -s -u <user>:<password> https://<central hostname>/v1/centralhealth/upgradestatus | jq -r .upgradeStatus.forceRollbackTo
현재 Central 인스턴스가 실행되고 있지 않은 경우 다음 단계를 수행합니다.
참고이 절차는 Rillsdb 데이터베이스를 설치할 때 RHACS 릴리스 3.74 및 이전
버전에만 사용할 수 있습니다.다음 명령을 실행하여 중앙 배포가 축소되었는지 확인합니다.
OpenShift Container Platform의 경우 다음 명령을 실행합니다.
$ oc scale -n <central namespace> –replicas=0 deploy/central
Kubernetes의 경우 다음 명령을 실행합니다.
$ kubectl scale -n <central namespace> –replicas=0 deploy/central
다음 Pod 사양을 YAML 파일로 저장합니다.
apiVersion: v1 kind: Pod metadata: name: get-previous-db-version spec: containers: - name: get-previous-db-version image: registry.redhat.io/advanced-cluster-security/rhacs-main-rhel8:<rollback version> command: - sh args: - '-c' - "cat /var/lib/stackrox/.previous/migration_version.yaml | grep '^image:' | cut -f 2 -d : | tr -d ' '" volumeMounts: - name: stackrox-db mountPath: /var/lib/stackrox volumes: - name: stackrox-db persistentVolumeClaim: claimName: stackrox-db저장한 YAML 파일을 사용하여 다음 명령을 실행하여 중앙 네임스페이스에 Pod를 생성합니다.
OpenShift Container Platform의 경우 다음 명령을 실행합니다.
$ oc create -n <central namespace> -f pod.yaml
Kubernetes의 경우 다음 명령을 실행합니다.
$ kubectl create -n <central namespace> -f pod.yaml
Pod 생성이 완료되면 다음 명령을 실행하여 버전을 가져옵니다.
OpenShift Container Platform의 경우 다음 명령을 실행합니다.
$ oc logs -n <central namespace> get-previous-db-version
Kubernetes의 경우 다음 명령을 실행합니다.
$ kubectl logs -n <central namespace> get-previous-db-version
central-config.yamlConfigMap을 편집하여 다음 명령을 실행하여maintenance.forceRollBackVersion:<version> 매개변수를 설정합니다.OpenShift Container Platform의 경우 다음 명령을 실행합니다.
$ oc get configmap -n <central namespace> central-config -o yaml | sed -e "s/forceRollbackVersion: none/forceRollbackVersion: <version>/" | oc -n <central namespace> apply -f -
Kubernetes의 경우 다음 명령을 실행합니다.
$ kubectl get configmap -n <central namespace> central-config -o yaml | sed -e "s/forceRollbackVersion: none/forceRollbackVersion: <version>/" | kubectl -n <central namespace> apply -f -
3단계에 표시된 version 문자열을 이미지 태그로 사용하여 중앙 배포의 이미지를 설정합니다. 예를 들어 다음 명령을 실행합니다.
OpenShift Container Platform의 경우 다음 명령을 실행합니다.
$ oc set image -n <central namespace> deploy/central central=registry.redhat.io/advanced-cluster-security/rhacs-main-rhel8:<version>
Kubernetes의 경우 다음 명령을 실행합니다.
$ kubectl set image -n <central namespace> deploy/central central=registry.redhat.io/advanced-cluster-security/rhacs-main-rhel8:<version>
검증
중앙 Pod가 시작되고
준비상태인지 확인합니다. Pod가 충돌하는 경우 로그를 확인하여 백업이 복원되었는지 확인합니다. 성공 로그 메시지는 다음 예와 유사합니다.Clone to Migrate ".previous", ""
-
롤백된 백엔드 채널에 Operator를 다시 설치합니다. 예를 들어
3.71.3은rhacs-3.71채널에 설치됩니다.