IBM Cloud Kubernetes Service 설정

15187 단어 ibmcloudkubernetes

개요



IBM Cloud Kubernetes Service를 사용하여 무료 클러스터를 작성해 보았습니다.
전체적으로 20분 정도로 클러스터 구축 및 CLI 명령 설정이 완료됩니다.
kubernetes를 사용해보고 싶은 분에게 추천합니다.

참고 문서



  • 무료 IBM Cloud 서비스 - 대한민국 | IBM
  • IBM Cloud Kubernetes Service - 개요 - 대한민국 |


  • IBM Cloud Docs

  • Kubernetes 클러스터 만들기
  • 이 기사의 내용은이 자습서를 참조합니다.



  • 계정 생성



    IBM Cloud 라이트 계정 | IBM Cloud - 대한민국 | IBM

    IBM Cloud 계정을 작성하지 않은 경우 작성하십시오.
    현재, 다음과 같은 접촉이 있어, 유익한 것 같습니다.
    従量制課金(PAYG)期間限定 無料キャンペーン
    
    3ヶ月間(90日間) または 最大US$500まで
    
    いまなら無料でご利用いただけます。
    お申し込み:2020年12月31日まで
    

    클러스터 만들기



    콘솔 에서 클러스터를 만듭니다.
    Pricing Plan 가 default 로 標準 이지만 無料 를 선택했습니다.
    장점과 서비스 오퍼링 에 비교가 있습니다.
    標準 는 9 작업자 노드(b3c.4x16 - 4vCPU 16GB RAM), 1 로드 밸런서가 붙는 유료 플랜인 것 같습니다.無料 는 1 작업자 노드(2vCPU 4GB RAM)와 같습니다.

    만일 작성하려고 했습니다만, アップグレードして作成 밖에 밀 수 없습니다.
    눌러 보면, 아무래도, 신용 카드의 등록등을 하지 않으면 안 되는 것이므로 실시했습니다.

    페이지를 다시 로드하면 作成 버튼이 나타나서 만들 수 있습니다.


    作成 버튼을 눌렀습니다. 작성이 시작된 것 같습니다.



    15분 정도로 만들어진 것 같습니다.
    이 대기 시간 동안 CLI를 설정하는 것이 좋습니다.



    IBM Cloud CLI 설정



    Mac/Linux/Windows에서 실시 가능한 것 같습니다.
    우분투에서 실시했습니다.

    환경
    $ cat /etc/lsb-release 
    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=20.04
    DISTRIB_CODENAME=focal
    DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
    loft@ubu20-01:~/dev$ uname -a
    Linux ubu20-01 5.4.0-48-generic #52-Ubuntu SMP Thu Sep 10 10:58:49 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
    $
    

    CLI를 설치하면 다음이 들어있는 것 같습니다, 환경을 더럽히고 싶지 않은 경우는 전용 VM 등을 준비하는 것이 좋을지도 모릅니다.
  • docker-ce
  • kubectl
  • helm (v2였습니다)
  • ibmcloud
  • $ curl -sL https://raw.githubusercontent.com/IBM-Cloud/ibm-cloud-developer-tools/master/linux-installer/idt-installer | bash
    ()
    $ docker version
    Client: Docker Engine - Community
     Version:           20.10.1
     API version:       1.41
     Go version:        go1.13.15
     Git commit:        831ebea
     Built:             Tue Dec 15 04:34:58 2020
     OS/Arch:           linux/amd64
     Context:           default
     Experimental:      true
    Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.24/version: dial unix /var/run/docker.sock: connect: permission denied
    $ kubectl version
    Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.13", GitCommit:"4c00c3c459261e8ff3381c1070ddf798f0131956", GitTreeState:"clean", BuildDate:"2020-12-09T11:18:24Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}
    The connection to the server localhost:8080 was refused - did you specify the right host or port?
    $ helm version
    Client: &version.Version{SemVer:"v2.17.0", GitCommit:"a690bad98af45b015bd3da1a41f6218b1a451dbe", GitTreeState:"clean"}
    Error: Get "http://localhost:8080/api/v1/namespaces/kube-system/pods?labelSelector=app%3Dhelm%2Cname%3Dtiller": dial tcp 127.0.0.1:8080: connect: connection refused
    $ ibmcloud version
    ibmcloud version 1.3.0+4308925-2020-12-16T07:53:49+00:00
    $ 
    

    CLI에서 IBM Cloud 계정에 로그인합니다.
    $ ibmcloud login
    API endpoint: https://cloud.ibm.com
    
    Email> xxxxxxxxx
    
    Password> xxxxxxxx
    Authenticating...
    OK
    
    Targeted account xxxxxx's Account (xxxxx) <-> xxxxxx
    
    
    Select a region (or press enter to skip):
    1. au-syd
    2. in-che
    3. jp-osa
    4. jp-tok
    5. kr-seo
    6. eu-de
    7. eu-gb
    8. ca-tor
    9. us-south
    10. us-east
    Enter a number> 4
    Targeted region jp-tok
    
    
    API endpoint:      https://cloud.ibm.com   
    Region:            jp-tok
    User:              xxxxxx
    Account:           xxxxxx
    (xxxxxx) <-> xxxxxx
    Resource group:    No resource group targeted, use 'ibmcloud target -g RESOURCE_GROUP'
    CF API endpoint:
    Org:
    Space:
    $ 
    $ ibmcloud plugin list
    Listing installed plug-ins...
    
    Plugin Name                            Version   Status   Private endpoints supported   
    cloud-functions/wsk/functions/fn       1.0.49             false
    cloud-object-storage                   1.2.1              false
    container-registry                     0.1.497            false
    container-service/kubernetes-service   1.0.208            false
    
    $ 
    $ ibmcloud cr namespace-add loft-test
    No resource group is targeted. Therefore, the default resource group for the account ('Default') is targeted.
    
    Adding namespace 'loft-test' in resource group 'Default' for account xxxxx's Account in registry jp.icr.io...
    
    Successfully added namespace 'loft-test'
    
    OK
    $ 
    

    클러스터가 작성되면 다음과 같이 StatusReady 가 됩니다.
    $ ibmcloud ks worker ls --cluster mycluster-free
    Kubernetes removed deprecated APIs, which impacts clusters that run Kubernetes version 1.16, OpenShift version 4.4, or later. For more information, see <http://ibm.biz/k8s-1-16-apis>
    
    The Kubernetes Ingress controller image is now supported for Ingress ALBs, and all new ALBs now run the Kubernetes Ingress image by default. Additionally, you must move any existing Ingress setups to the new Kubernetes Ingress before support for the legacy IBM Cloud Kubernetes Service Ingress image ends on April 30, 2021. More info: <https://ibm.biz/kube-ingress>
    
    From 01 December 2020 virtual and bare metal servers that run Ubuntu 16 will be deprecated, in consideration of the upcoming April 2021 end-of-support date for Ubuntu 16. For more details, please see the announcement <https://ibm.biz/kube-flavors>
    
    From 01 December 2020 the older generation bare metal flavors will be deprecated. For more details, please see the announcement <https://ibm.biz/kube-flavors>
    
    OK
    ID                                                       Public IP        Private IP       Flavor   State    Status   Zone    Version   
    kube-bveujrpf0crbek524ph0-myclusterfr-default-00000091   169.51.205.148   10.144.195.254   free     normal   Ready    mil01   1.18.12_1535
    $
    

    컨텍스트를 설정합니다.
    $ ibmcloud ks cluster config --cluster mycluster-free
    OK
    The configuration for mycluster-free was downloaded successfully.
    
    Added context for mycluster-free to the current kubeconfig file.
    You can now execute 'kubectl' commands against your cluster. For example, run 'kubectl get nodes'.
    If you are accessing the cluster for the first time, 'kubectl' commands might fail for a few seconds while RBAC synchronizes.
    
    kubectl 명령이 사용 가능합니다.
    $ kubectl config current-context
    mycluster-free/bveujrpf0crbek524ph0
    $ kubectl version
    Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.13", GitCommit:"4c00c3c459261e8ff3381c1070ddf798f0131956", GitTreeState:"clean", BuildDate:"2020-12-09T11:18:24Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}
    Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.13+IKS", GitCommit:"ffaac9a56c5a85ae56a4a7a694d83b9acaa8ea5e", GitTreeState:"clean", BuildDate:"2020-12-09T23:56:57Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}
    $ kubectl cluster-info
    Kubernetes master is running at https://c109.eu-de.containers.cloud.ibm.com:30137
    CoreDNS is running at https://c109.eu-de.containers.cloud.ibm.com:30137/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
    kubernetes-dashboard is running at https://c109.eu-de.containers.cloud.ibm.com:30137/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy
    Metrics-server is running at https://c109.eu-de.containers.cloud.ibm.com:30137/api/v1/namespaces/kube-system/services/https:metrics-server:/proxy
    NodeLocalDNS is running at https://c109.eu-de.containers.cloud.ibm.com:30137/api/v1/namespaces/kube-system/services/node-local-dns:dns/proxy
    
    To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
    $ kubectl get no
    NAME             STATUS   ROLES    AGE   VERSION     
    10.144.195.254   Ready    <none>   16m   v1.18.12+IKS
    $ kubectl get po -A
    NAMESPACE     NAME                                         READY   STATUS    RESTARTS   AGE
    ibm-system    addon-catalog-source-kdjn4                   1/1     Running   0          13m
    ibm-system    catalog-operator-64dcd56d5d-xd5g5            1/1     Running   0          19m
    ibm-system    olm-operator-7c5f5cc854-gsm4k                1/1     Running   0          19m
    kube-system   calico-kube-controllers-867cf6c58f-g2qgp     1/1     Running   0          21m
    kube-system   calico-node-gmmnm                            1/1     Running   0          16m
    kube-system   coredns-6864b999b5-6gtpq                     1/1     Running   0          15m
    kube-system   coredns-6864b999b5-kkxz2                     1/1     Running   0          15m
    kube-system   coredns-6864b999b5-tggsj                     1/1     Running   0          20m
    kube-system   coredns-autoscaler-59c85689b8-5dld9          1/1     Running   0          20m
    kube-system   dashboard-metrics-scraper-67dbf8bdb8-z745k   1/1     Running   0          19m
    kube-system   ibm-keepalived-watcher-s868v                 1/1     Running   0          16m
    kube-system   ibm-kubelet-monitor-xc59n                    1/1     Running   0          16m
    kube-system   ibm-master-proxy-static-10.144.195.254       2/2     Running   0          16m
    kube-system   kubernetes-dashboard-785d6cd576-fg8hr        1/1     Running   0          19m
    kube-system   metrics-server-769c687bc7-h6kwm              2/2     Running   0          15m
    kube-system   vpn-6dd5596479-kn9b7                         1/1     Running   0          19m
    $ kubectl get svc -A
    NAMESPACE     NAME                                 TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                  AGE
    default       kubernetes                           ClusterIP   172.21.0.1       <none>        443/TCP                  23m
    ibm-system    addon-catalog-source                 ClusterIP   172.21.206.39    <none>        50051/TCP                13m
    ibm-system    catalog-operator-metrics             ClusterIP   172.21.12.209    <none>        8081/TCP                 19m
    ibm-system    olm-operator-metrics                 ClusterIP   172.21.34.12     <none>        8081/TCP                 19m
    kube-system   dashboard-metrics-scraper            ClusterIP   172.21.164.96    <none>        8000/TCP                 19m
    kube-system   ibm-k8s-controller-default-backend   ClusterIP   172.21.137.5     <none>        80/TCP                   19m
    kube-system   kube-dns                             ClusterIP   172.21.0.10      <none>        53/UDP,53/TCP,9153/TCP   20m
    kube-system   kubernetes-dashboard                 ClusterIP   172.21.112.254   <none>        443/TCP                  19m
    kube-system   metrics-server                       ClusterIP   172.21.117.249   <none>        443/TCP                  19m
    kube-system   node-local-dns                       ClusterIP   172.21.90.173    <none>        53/UDP,53/TCP            20m
    $
    

    지금까지 20분 정도에 kubernetes 클러스터를 사용할 수 있게 되었습니다.
    이번 소개한 튜토리얼에는 어플리케이션의 배포 순서등도 기재되어 있으므로 시험으로 kubernetes를 만지고 싶은 분에게 추천입니다.

    좋은 웹페이지 즐겨찾기