4.5. 컨트롤 플레인 시스템 관리
컨트롤 플레인 머신 세트는 컴퓨팅 머신에 제공하는 컴퓨팅 머신 세트와 유사한 컨트롤 플레인 시스템에 대한 관리 기능을 제공합니다. 클러스터의 컨트롤 플레인 머신 세트의 가용성 및 초기 상태는 클라우드 공급자와 설치한 OpenShift Container Platform 버전에 따라 다릅니다. 자세한 내용은 컨트롤 플레인 머신 세트 시작하기를 참조하십시오.
4.5.1. 클러스터에 컨트롤 플레인 노드 추가 링크 복사링크가 클립보드에 복사되었습니다!
베어 메탈 인프라에 클러스터를 설치할 때 클러스터의 컨트롤 플레인 노드를 4개 또는 5개로 수동으로 확장할 수 있습니다. 절차의 예제에서는 node-5 를 새 컨트롤 플레인 노드로 사용합니다.
사전 요구 사항
- 컨트롤 플레인 노드가 3개 이상인 정상 클러스터가 설치되어 있습니다.
- postinstalltion 작업으로 클러스터에 추가하려는 단일 컨트롤 플레인 노드를 생성했습니다.
프로세스
다음 명령을 입력하여 새 컨트롤 플레인 노드에 대해 보류 중인 인증서 서명 요청(CSR)을 검색합니다.
$ oc get csr | grep Pending다음 명령을 입력하여 컨트롤 플레인 노드에 보류 중인 모든 CSR을 승인합니다.
$ oc get csr -o go-template='{{range .items}}{{if not .status}}{{.metadata.name}}{{"\n"}}{{end}}{{end}}' | xargs --no-run-if-empty oc adm certificate approve중요설치를 완료하려면 CSR을 승인해야 합니다.
다음 명령을 입력하여 컨트롤 플레인 노드가
Ready상태에 있는지 확인합니다.$ oc get nodes참고설치 관리자 프로비저닝 인프라에서 etcd Operator는 Machine API를 사용하여 컨트롤 플레인을 관리하고 etcd 쿼럼을 확인합니다. 그런 다음 Machine API는
MachineCR을 사용하여 기본 컨트롤 플레인 노드를 표시하고 관리합니다.BareMetalHost및MachineCR을 생성하여 컨트롤 플레인 노드의NodeCR에 연결합니다.다음 예와 같이 고유한
.metadata.name값을 사용하여BareMetalHostCR을 생성합니다.apiVersion: metal3.io/v1alpha1 kind: BareMetalHost metadata: name: node-5 namespace: openshift-machine-api spec: automatedCleaningMode: metadata bootMACAddress: 00:00:00:00:00:02 bootMode: UEFI customDeploy: method: install_coreos externallyProvisioned: true online: true userData: name: master-user-data-managed namespace: openshift-machine-api # ...다음 명령을 입력하여
BareMetalHostCR을 적용합니다.$ oc apply -f <filename>1 - 1
- <filename>을
BareMetalHostCR의 이름으로 바꿉니다.
다음 예와 같이 고유한
.metadata.name값을 사용하여MachineCR을 생성합니다.apiVersion: machine.openshift.io/v1beta1 kind: Machine metadata: annotations: machine.openshift.io/instance-state: externally provisioned metal3.io/BareMetalHost: openshift-machine-api/node-5 finalizers: - machine.machine.openshift.io labels: machine.openshift.io/cluster-api-cluster: <cluster_name>1 machine.openshift.io/cluster-api-machine-role: master machine.openshift.io/cluster-api-machine-type: master name: node-5 namespace: openshift-machine-api spec: metadata: {} providerSpec: value: apiVersion: baremetal.cluster.k8s.io/v1alpha1 customDeploy: method: install_coreos hostSelector: {} image: checksum: "" url: "" kind: BareMetalMachineProviderSpec metadata: creationTimestamp: null userData: name: master-user-data-managed # ...- 1
- &
lt;cluster_name>을 특정 클러스터의 이름으로 바꿉니다(예:test-day2-1-6qv96).
다음 명령을 실행하여 클러스터 이름을 가져옵니다.
$ oc get infrastructure cluster -o=jsonpath='{.status.infrastructureName}{"\n"}'다음 명령을 입력하여
머신CR을 적용합니다.$ oc apply -f <filename>1 - 1
- &
lt;filename>을MachineCR의 이름으로 바꿉니다.
link-machine-and-node.sh스크립트를 실행하여BareMetalHost,Machine및Node오브젝트를 연결합니다.다음
link-machine-and-node.sh스크립트를 로컬 머신에 복사합니다.#!/bin/bash # Credit goes to # https://bugzilla.redhat.com/show_bug.cgi?id=1801238. # This script will link Machine object # and Node object. This is needed # in order to have IP address of # the Node present in the status of the Machine. set -e machine="$1" node="$2" if [ -z "$machine" ] || [ -z "$node" ]; then echo "Usage: $0 MACHINE NODE" exit 1 fi node_name=$(echo "${node}" | cut -f2 -d':') oc proxy & proxy_pid=$! function kill_proxy { kill $proxy_pid } trap kill_proxy EXIT SIGINT HOST_PROXY_API_PATH="http://localhost:8001/apis/metal3.io/v1alpha1/namespaces/openshift-machine-api/baremetalhosts" function print_nics() { local ips local eob declare -a ips readarray -t ips < <(echo "${1}" \ | jq '.[] | select(. | .type == "InternalIP") | .address' \ | sed 's/"//g') eob=',' for (( i=0; i<${#ips[@]}; i++ )); do if [ $((i+1)) -eq ${#ips[@]} ]; then eob="" fi cat <<- EOF { "ip": "${ips[$i]}", "mac": "00:00:00:00:00:00", "model": "unknown", "speedGbps": 10, "vlanId": 0, "pxe": true, "name": "eth1" }${eob} EOF done } function wait_for_json() { local name local url local curl_opts local timeout local start_time local curr_time local time_diff name="$1" url="$2" timeout="$3" shift 3 curl_opts="$@" echo -n "Waiting for $name to respond" start_time=$(date +%s) until curl -g -X GET "$url" "${curl_opts[@]}" 2> /dev/null | jq '.' 2> /dev/null > /dev/null; do echo -n "." curr_time=$(date +%s) time_diff=$((curr_time - start_time)) if [[ $time_diff -gt $timeout ]]; then printf '\nTimed out waiting for %s' "${name}" return 1 fi sleep 5 done echo " Success!" return 0 } wait_for_json oc_proxy "${HOST_PROXY_API_PATH}" 10 -H "Accept: application/json" -H "Content-Type: application/json" addresses=$(oc get node -n openshift-machine-api "${node_name}" -o json | jq -c '.status.addresses') machine_data=$(oc get machines.machine.openshift.io -n openshift-machine-api -o json "${machine}") host=$(echo "$machine_data" | jq '.metadata.annotations["metal3.io/BareMetalHost"]' | cut -f2 -d/ | sed 's/"//g') if [ -z "$host" ]; then echo "Machine $machine is not linked to a host yet." 1>&2 exit 1 fi # The address structure on the host doesn't match the node, so extract # the values we want into separate variables so we can build the patch # we need. hostname=$(echo "${addresses}" | jq '.[] | select(. | .type == "Hostname") | .address' | sed 's/"//g') set +e read -r -d '' host_patch << EOF { "status": { "hardware": { "hostname": "${hostname}", "nics": [ $(print_nics "${addresses}") ], "systemVendor": { "manufacturer": "Red Hat", "productName": "product name", "serialNumber": "" }, "firmware": { "bios": { "date": "04/01/2014", "vendor": "SeaBIOS", "version": "1.11.0-2.el7" } }, "ramMebibytes": 0, "storage": [], "cpu": { "arch": "x86_64", "model": "Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz", "clockMegahertz": 2199.998, "count": 4, "flags": [] } } } } EOF set -e echo "PATCHING HOST" echo "${host_patch}" | jq . curl -s \ -X PATCH \ "${HOST_PROXY_API_PATH}/${host}/status" \ -H "Content-type: application/merge-patch+json" \ -d "${host_patch}" oc get baremetalhost -n openshift-machine-api -o yaml "${host}"다음 명령을 입력하여 스크립트를 실행 가능하게 만듭니다.
$ chmod +x link-machine-and-node.sh다음 명령을 입력하여 스크립트를 실행합니다.
$ bash link-machine-and-node.sh node-5 node-5참고첫 번째
node-5인스턴스는 시스템을 나타내며 두 번째 인스턴스는 노드를 나타냅니다.
검증
기존 컨트롤 플레인 노드 중 하나로 실행하여 etcd의 멤버를 확인합니다.
다음 명령을 입력하여 컨트롤 플레인 노드에 대한 원격 쉘 세션을 엽니다.
$ oc rsh -n openshift-etcd etcd-node-0etcd 멤버를 나열합니다.
# etcdctl member list -w table
다음 명령을 입력하여 완료할 때까지 etcd Operator 설정 프로세스를 확인합니다. 예상 출력은
PROGRESSING열에False를 표시합니다.$ oc get clusteroperator etcd다음 명령을 실행하여 etcd 상태를 확인합니다.
컨트롤 플레인 노드에 대한 원격 쉘 세션을 엽니다.
$ oc rsh -n openshift-etcd etcd-node-0끝점 상태를 확인합니다. 예상
출력은 끝점에대해 정상입니다.# etcdctl endpoint health
다음 명령을 입력하여 모든 노드가 준비되었는지 확인합니다. 예상 출력에는 각 노드 항목 옆에
Ready상태가 표시됩니다.$ oc get nodes다음 명령을 입력하여 클러스터 Operator를 모두 사용할 수 있는지 확인합니다. 예상 출력은 각 Operator를 나열하고 각 나열된 Operator 옆에
True로 사용 가능한 상태를 표시합니다.$ oc get ClusterOperators다음 명령을 입력하여 클러스터 버전이 올바른지 확인합니다.
$ oc get ClusterVersion출력 예
NAME VERSION AVAILABLE PROGRESSING SINCE STATUS version OpenShift Container Platform.5 True False 5h57m Cluster version is OpenShift Container Platform.5