OpenShift 4를 설치하기 전에 일부 NCP 구성 파일을 업데이트해야 합니다.

YAML 파일은 download.vmware.com의 NCP 다운로드 파일에 포함되어 있습니다. 링크(https://github.com/vmware/nsx-container-plugin-operator/releases)로 이동하고, 해당 Operator 릴리스(예: v3.1.1)를 찾은 후 openshift4.tar.gz를 다운로드할 수 있습니다.

다음 파일은 nsx-container-plugin-operator/deploy 폴더에 있습니다.
  • configmap.yaml – 이 파일을 NSX-T 정보로 업데이트합니다.
  • operator.yaml – 이 파일에 NCP 이미지 위치를 지정합니다.
  • namespace.yaml – Operator에 대한 네임 스페이스 규격입니다. 이 파일은 편집하지 마십시오.
  • role_binding.yaml - Operator에 대한 역할 바인딩 규격입니다. 이 파일은 편집하지 마십시오.
  • role.yaml - Operator에 대한 역할 규격입니다. 이 파일은 편집하지 마십시오.
  • service_account.yaml - Operator에 대한 서비스 계정 규격입니다. 이 파일은 편집하지 마십시오.
  • lb-secret.yaml - 기본 NSX-T 로드 밸런서 인증서에 대한 암호입니다.
  • nsx-secret.yaml - NSX-T에 대한 인증서 기반 인증 암호입니다. configmap.yaml에서 nsx_api_usernsx_api_password 대신 사용됩니다.
  • operator.nsx.vmware.com_ncpinstalls_crd.yaml - Operator 소유 고객 리소스 정의입니다.
  • operator.nsx.vmware.com_v1_ncpinstall_cr.yaml - Operator 소유 고객 리소스입니다.
다음 configmap.yaml 예는 기본 구성을 보여 줍니다. 추가 옵션은 deploy 폴더의 configmap.yaml을 참조하십시오. 환경에 따라 다음 매개 변수에 대한 값을 지정해야 합니다.
  • 클러스터
  • nsx_api_managers
  • nsx_api_user
  • nsx_api_password
  • external_ip_pools
  • tier0_gateway
  • overlay_tz
  • edge_cluster
  • apiserver_host_ip
  • apiserver_host_port
kind: ConfigMap 
metadata: 
  name: nsx-ncp-operator-config 
  namespace: nsx-system-operator 
data: 
  ncp.ini: | 
    [vc] 

    [coe] 

    # Container orchestrator adaptor to plug in. 
    adaptor = openshift4 

    # Specify cluster name. 
    cluster = ocp 

    [DEFAULT] 

    [nsx_v3] 
    policy_nsxapi = True 
    # Path to NSX client certificate file. If specified, the nsx_api_user and 
    # nsx_api_password options will be ignored. Must be specified along with 
    # nsx_api_private_key_file option 
    #nsx_api_cert_file = <None> 

    # Path to NSX client private key file. If specified, the nsx_api_user and 
    # nsx_api_password options will be ignored. Must be specified along with 
    # nsx_api_cert_file option 
    #nsx_api_private_key_file = <None> 

    nsx_api_managers = 10.114.209.10,10.114.209.11,10.114.209.12 

    nsx_api_user = admin 
    nsx_api_password = VMware1! 

    # Do not use in production 
    insecure = True 

    # Choices: ALL DENY <None> 
    log_firewall_traffic = DENY 

    external_ip_pools = 10.114.17.0/25 
    #top_tier_router = <None> 
    tier0_gateway = t0a 
    single_tier_topology = True 
    overlay_tz = 3efa070d-3870-4eb1-91b9-a44416637922 
    edge_cluster = 3088dc2b-d097-406e-b9de-7a161e8d0e47 

    [ha] 

    [k8s] 
    # Kubernetes API server IP address. 
    apiserver_host_ip = api-int.ocp.yasen.local 

    # Kubernetes API server port. 
    apiserver_host_port = 6443 

    client_token_file = /var/run/secrets/kubernetes.io/serviceaccount/token 

    # Choices: <None> allow_cluster allow_namespace 
    baseline_policy_type = allow_cluster 
    enable_multus = False 
    process_oc_network = False 
 
    [nsx_kube_proxy] 

    [nsx_node_agent] 

    ovs_bridge = br-int 

    # The OVS uplink OpenFlow port 
    ovs_uplink_port = ens192 

    [operator] 

    # The default certificate for HTTPS load balancing. 
    # Must be specified along with lb_priv_key option. 
    # Operator will create lb-secret for NCP based on these two options. 
    #lb_default_cert = <None> 

    # The private key for default certificate for HTTPS load balancing. 
    # Must be specified along with lb_default_cert option. 
    #lb_priv_key = <None>
operator.yamlenv 섹션에서 NCP 이미지의 위치를 지정해야 합니다.
kind: Deployment
metadata: 
  name: nsx-ncp-operator 
  namespace: nsx-system-operator 
spec: 
  replicas: 1 
  selector: 
    matchLabels: 
      name: nsx-ncp-operator 
  template: 
    metadata: 
      labels: 
        name: nsx-ncp-operator 
    spec: 
      hostNetwork: true 
      serviceAccountName: nsx-ncp-operator 
      tolerations: 
      - effect: NoSchedule 
        key: node-role.kubernetes.io/master 
      - effect: NoSchedule 
        key: node.kubernetes.io/not-ready 
      containers: 
        - name: nsx-ncp-operator 
          # Replace this with the built image name 
          image: vmware/nsx-container-plugin-operator:latest 
          command: ["/bin/bash", "-c", "nsx-ncp-operator --zap-time-encoding=iso8601"] 
          imagePullPolicy: Always 
          env: 
            - name: POD_NAME 
              valueFrom: 
                fieldRef: 
                  fieldPath: metadata.name 
            - name: OPERATOR_NAME 
              value: "nsx-ncp-operator" 
            - name: NCP_IMAGE 
              value: "{NCP Image}"

Operator 이미지의 경우 설치해야 할 NCP 버전을 지정합니다. 예를 들어 NCP 3.1.1의 경우 Operator 이미지는 vmware/nsx-container-plugin-operator:v3.1.1입니다.

속도 제한 정책 때문에 운영 환경에서는 dockerhub를 직접 끌어오는 것은 권장되지 않습니다. dockerhub에서 끌어오면 이미지가 NCP 이미지를 사용할 수 있는 곳과 동일한 위치의 로컬 레지스트리로 푸시될 수 있습니다.

또는 download.vmware.com의 NCP 다운로드 파일에 포함된 Operator 이미지 파일을 사용하고 로컬 레지스트리로 가져올 수 있습니다. 이 이미지는 VMware dockerhub에 게시된 것과 동일합니다.

CNI의 MTU 값을 설정하려면 Operator ConfigMap의 [nsx-node-agent] 섹션에서 mtu 매개 변수를 수정합니다. Operator는 nsx-ncp-boostrap 포드의 재생성을 트리거하고 CNI 구성 파일이 모든 노드에서 제대로 업데이트되도록 합니다. 이에 따라 노드 MTU도 업데이트해야 합니다. 노드와 포드 MTU가 일치하지 않으면 node-pod 통신(예: TCP 작동 여부 및 준비 프로브)에 영향을 줄 수 있습니다.

노드의 인터페이스에서 MTU를 업데이트하려면 명령 ovs-vsctl set Interface <interface-name> mtu_request=<mtu-value>를 실행하면 됩니다. 여기서 interface-name은 nsx-node-agent 포드에서 실행되는 nsx-ovs 컨테이너의 OVS 인터페이스 또는 물리적 인터페이스일 수 있습니다. 예를 들면 oc -n nsx-system exec -it nsx-node-agent-dqqm9 -c nsx-ovs -- ovs-vsctl set Interface ens192 mtu_request=9000와 같습니다.

참고: 기본적으로 ncpReplicas 매개 변수는 1로 설정되어 있기 때문에, Operator ConfigMap에서 HA를 사용하도록 설정하면 단일 NCP 포드를 생성합니다. 3개의 NCP 포드를 생성하려면 3으로 변경할 수 있습니다. 클러스터가 설치된 후 oc edit ncpinstalls ncp-install -n nsx-system 명령을 사용하여 NCP 복제본 수를 변경할 수 있습니다.

다음은 operator.nsx.vmware.com_v1_ncpinstall_cr.yaml 예입니다. 노드에 여러 네트워크 인터페이스가 있는 경우 addNodeTag 매개 변수를 false로 설정해야 합니다.
apiVersion: operator.nsx.vmware.com/v1
kind: NcpInstall
metadata:
  name: ncp-install
  namespace: nsx-system-operator
spec:
  ncpReplicas: 1
  # Note that if one node has multiple attached VirtualNetworkInterfaces, this function is not supported and should be set to false
  addNodeTag: true
  nsx-ncp:
    # Uncomment below to add user-defined nodeSelector for NCP Deployment
    #nodeSelector:
      #<node_label_key>: <node_label_value>
    tolerations:
      # Please don't modify below default tolerations for NCP Deployment
      - key: node-role.kubernetes.io/master
        effect: NoSchedule
      - key: node.kubernetes.io/network-unavailable
        effect: NoSchedule
      # Uncomment below to add user-defined tolerations for NCP Deployment
      #<toleration_specification>
      
  nsx-node-agent:
    tolerations:
      # Please don't modify below default tolerations
      # for nsx-ncp-bootstrap and nsx-node-agent DaemonSet
      - key: node-role.kubernetes.io/master
        effect: NoSchedule
      - key: node.kubernetes.io/not-ready
        effect: NoSchedule
      - key: node.kubernetes.io/unreachable
        effect: NoSchedule
      - operator: Exists
        effect: NoExecute 
      # Uncomment below to add user-defined tolerations for nsx-ncp-bootstrap and nsx-node-agent DaemonSet
      #<toleration_specification>

주체 ID를 사용하여 NSX-T 인증서 기반 인증 구성

운영 환경에서는 configmap.yaml에서 nsx_api_usernsx_api_password 매개 변수를 사용하여 관리자 자격 증명을 제공하지 않는 것이 좋습니다. 다음 단계에서는 주체 ID를 생성하고 NCP에서 인증을 위해 인증서를 사용하도록 허용하는 방법을 설명합니다.

  1. 인증서 및 키를 생성합니다.
  2. NSX Manager에서 시스템 > 사용자 및 역할로 이동한 후 추가 > 역할을 가진 주체 ID를 클릭합니다. 주체 ID를 추가하고 1단계에서 생성한 인증서를 붙여 넣습니다.
  3. nsx-secret.yaml에 base64로 인코딩된 crt 및 키 값을 추가합니다.
  4. configmap.yaml의 [nsx_v3] 섹션 아래에서 인증서 및 키 파일의 위치를 설정합니다.
    nsx_api_cert_file = /etc/nsx-ujo/nsx-cert/tls.crt
    nsx_api_private_key_file = /etc/nsx-ujo/nsx-cert/tls.key

참고: 이미 부트스트랩된 클러스터에서 인증 방법을 변경하는 것은 지원되지 않습니다.

(선택 사항) 기본 NSX-T 로드 밸런서 인증서 구성

NSX-T 로드 밸런서는 OpenShift HTTPS 경로 개체를 구현하고 OCP HAProxy를 오프로드할 수 있습니다. 이를 위해 기본 인증서가 필요합니다. 다음 단계를 수행하여 기본 인증서를 구성합니다.

  1. lb-secret.yaml에 base64로 인코딩된 crt 및 키 값을 추가합니다.
  2. configmap.yaml[nsx_v3] 섹션 아래에서 인증서 및 키의 위치를 설정합니다.
    lb_default_cert_path = /etc/nsx-ujo/lb-cert/tls.crt
    lb_priv_key_path = /etc/nsx-ujo/lb-cert/tls.key

(선택 사항) NSX Manager에 대한 인증서 기반 인증 구성

ConfigMap에서 insecure = False를 설정하는 경우 NSX Manager 클러스터에 있는 관리자 3개의 인증서 지문을 모두 지정해야 합니다. 다음 절차는 이 작업을 수행하는 방법의 예입니다.

3개의 NSX Manager의 인증서를 파일에 복사합니다.

ssh -l admin 10.114.209.10 -f 'get certificate api' > nsx1.crt
ssh -l admin 10.114.209.11 -f 'get certificate api' > nsx2.crt
ssh -l admin 10.114.209.12 -f 'get certificate api' > nsx3.crt

NSX1=`openssl x509 -in nsx1.crt -fingerprint -noout|awk -F"=" '{print $2}'`
NSX2=`openssl x509 -in nsx2.crt -fingerprint -noout|awk -F"=" '{print $2}'`
NSX3=`openssl x509 -in nsx3.crt -fingerprint -noout|awk -F"=" '{print $2}'`
THUMB="$NSX1,$NSX2,$NSX3"
echo $THUMB

ConfigMap을 편집하고 [nsx_v3] 섹션에서 지문을 추가합니다.

oc edit cm nsx-ncp-operator-config -n nsx-system-operator

    nsx_api_managers = 10.114.209.10,10.114.209.11,10.114.209.12
    nsx_api_user = admin
    nsx_api_password = VMwareVMware1!
    insecure = False
    thumbprint = E0:A8:D6:06:88:B9:65:7D:FB:F8:14:CF:D5:E5:23:98:C9:43:10:71,A7:B0:26:B5:B2:F6:72:2B:39:86:19:84:E6:DD:AB:43:16:0E:CE:BD,52:9B:99:90:88:4C:9F:9B:83:5E:F7:AF:FC:60:06:50:BE:9E:32:08