Ncloud Kubernetes Service 연동
    • PDF

    Ncloud Kubernetes Service 연동

    • PDF

    Article Summary

    VPC 환경에서 이용 가능합니다.

    참고

    NCP 서비스 브로커를 통해 Ncloud Kubernetes Service를 사용하려면 먼저 Ncloud Kubernetes Service 이용 신청을 완료해야 합니다.

    Ncloud Kubernetes Service의 10 노드 플랜 생성 예제

    서비스 생성

    cf create-service 서비스 플랜 서비스명 -c 설정 명령으로 마켓플레이스의 서비스를 생성해 주십시오.

    $ cf create-service nks 10 nks-sample -c '{
        "name":"cluster-sample",
        "k8sVersion":"1.21.9-nks.1",
        "subnetNoList":"1000 1001",
        "publicNetwork":true,
        "lbPrivateSubnetNo":100,
        "lbPublicSubnetNo": 101,
        "loginKeyName":"test",
        "defaultNodePool.name":"dnp-sample",
        "defaultNodePool.nodeCount":1,
        "defaultNodePool.productCode":"SVR.VSVR.STAND.C002.M008.NET.SSD.B050.G002",
        "log.audit":true,
        "nodePool":"[{\"name\":\"np-sample\",\"productCode\":\"SVR.VSVR.STAND.C002.M008.NET.SSD.B050.G002\",\"nodeCount\":1}]"
      }'
      Creating service instance nks-sample in org system / space system-space as admin...
      
      Create in progress. Use 'cf services' or 'cf service nks-sample' to check operation status.
      OK
    
    참고
    • Input Parameter를 json파일로 저장하여 cf create-service nks 10 nks-sample -c nks.json 명령어를 사용할 수도 있습니다.
    • 입력 가능한 변수는 여기를 클릭해 확인할 수 있습니다.
      (PaaS-TA에 이미 설정된 regionCode, zoneNo, vpc, DefaultNodePool.subnetNo은 입력할 수 없습니다.)
    주의

    Ncloud kubernetes Service 생성 시 Bosh 서비스 브로커와 PaaS-TA for Ncloud Kubernetes Service 브로커의 입력 가능한 변수가 다르므로 주의해 주십시오.

    서비스 상태 확인

    cf service 서비스명 명령으로 서비스 상태를 확인해 주십시오.

    • status에 서비스 상태(create in progress)가 표시됩니다.
    $ cf service nks-sample
      Showing info of service nks-sample in org system / space system-space as admin...
    
      name:             nks-sample
      service:          nks
      tags:
      plan:             10
      description:      A Kubernetes service, managed by NaverCloudPlatform.
      documentation:    https://guide-gov.ncloud-docs.com/release-20240222/docs/k8s-k8soverview
      dashboard:
      service broker:   ncp-service-broker
    
      Showing status of last operation from service nks-sample...
    
      status:    create in progress
      message:
      started:   2021-10-19T09:15:24Z
      updated:   2021-10-19T09:15:25Z
    
      There are no bound apps for this service.
    
      Upgrades are not supported by this broker.
    
    • Ncloud Kubernetes Service 클러스터 생성이 완료되면 서비스 상태가 생성 성공(create succeeded) 으로 변경됩니다.
    $ cf service nks-sample
      Showing info of service nks-sample in org portal-org / space portal-space as admin...
    
      name:             nks-sample
      service:          nks
      tags:             
      plan:             10
      description:      A Kubernetes service, managed by NaverCloudPlatform.
      documentation:    https://guide-gov.ncloud-docs.com/release-20240222/docs/k8s-k8soverview
      dashboard:        
      service broker:   ncp-service-broker
    
      Showing status of last operation from service nks-0728-1156...
    
      status:    create succeeded
      message:   
      started:   2021-10-19T09:15:24Z
      updated:   2021-10-19T09:35:19Z
    
      There are no bound apps for this service.
    
      Upgrades are not supported by this broker.
    

    서비스 사용(Admin 인증 클러스터)

    참고

    2022.03.24 이후에 생성된 Ncloud Kubernetes Service 클러스터는 IAM 인증이 자동으로 적용됩니다. 서비스 사용(IAM 인증 클러스터)를 참고해 주십시오.

    1. cf curl "/v3/service_instances" | jq -r '.resources[] | select(.name == "서비스명") | .last_operation.description' | base64 -d > kubeconfig.yaml 명령으로 메시지를 파싱하여 kubeconfig.yaml 파일로 저장해 주십시오.
    참고

    이 명령어를 사용하려면 jq 설치가 필요합니다.

    $ cf curl "/v3/service_instances" | jq -r '.resources[] | select(.name == "nks-sample") | .last_operation.description' | base64 -d > kubeconfig.yaml
    $ cat kubeconfig.yaml 
      apiVersion: v1
      clusters:
      - cluster:
          certificate-authority-data: ...
          server: https://....kr.vnks.gov-ntruss.com
        name: kubernetes
      contexts:
      - context:
          cluster: kubernetes
          user: kubernetes-admin
        name: kubernetes-admin@kubernetes
      current-context: kubernetes-admin@kubernetes
      kind: Config
      preferences: {}
      users:
      - name: kubernetes-admin
        user:
          client-certificate-data: ...
          client-key-data: ...
    
    1. 저장된 kubeconfig 파일을 사용하여 kubectl get node 명령을 실행해 주십시오.
    참고

    이 명령어를 사용하려면 kubectl 설치가 필요합니다.

    $ kubectl --kubeconfig kubeconfig.yaml get node
      NAME                STATUS   ROLES    AGE   VERSION
      nks-pool-79-w-21h   Ready    <none>   18m   v1.18.17
    

    서비스 사용(IAM 인증 클러스터)

    1. cf service {서비스명} 명령으로 message에 포함된 cluster UUID를 확인합니다.
    $ cf service nks-sample
    Showing info of service nks-sample in org system / space system-space as admin...
    
    name:             nks-sample
    service:          nks
    tags:
    plan:             10
    description:      A Kubernetes service, managed by NaverCloudPlatform.
    documentation:    https://guide-gov.ncloud-docs.com/release-20240222/docs/k8s-k8soverview
    dashboard:
    service broker:   ncp-service-broker
    
    Showing status of last operation from service nks-sample2...
    
    status:    create succeeded
    message:   To use the kubectl command through IAM authentication, you should install ncp-iam-authenticator and edit the kubectl configuration file to use it for authentication.
    authenticationGuideURL=https://guide-gov.ncloud-docs.com/release-20240222/docs/k8s-iam-auth-ncp-iam-authenticator        
    clusterUuid=e30e5cf4-6a92-489a-aea4-252d6583bf5e
    started:   2022-03-10T06:30:03Z
    updated:   2022-03-10T06:45:48Z
    
    There are no bound apps for this service.
    
    Upgrades are not supported by this broker.
    
    1. ncp-iam-authenticator 설치를 참고하여 ncp-iam-authenticator를 설치해 주십시오.
    2. IAM 인증 kubeconfig 생성을 참고하여 kubeconfig를 생성해 주십시오.
    3. 저장된 kubeconfig 파일을 사용하여 kubectl get node 명령을 실행해 주십시오.
      참고

      이 명령어를 사용하려면 kubectl 설치가 필요합니다.

    $ kubectl --kubeconfig kubeconfig.yaml get node
      NAME                STATUS   ROLES    AGE   VERSION
      nks-pool-79-w-21h   Ready    <none>   18m   v1.18.17
    

    서비스 삭제

    cf delete-service 서비스명 명령으로 서비스를 삭제해 주십시오.

    $  cf delete-service nks-sample
    This action impacts all resources scoped to this service instance, including service bindings, service keys and route bindings.
    This will remove the service instance from any spaces where it has been shared.
    Really delete the service instance nks-sample? [yN]: y
    Deleting service instance nks-sample in org system / space system-space as admin
    
    Service instance nks-sample deleted.
    OK
    

    이 문서가 도움이 되었습니까?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.