ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [Kubernetes] Kubernetes ( CentOS 7 ) 정지. 삭제
    IT 발자취.../쿠버네티스 2020. 4. 9. 16:03

    쿠버네티스 설치 블로깅을 적다가 ... 갑자기 삭제 블로깅으로 바뀐 포스터

     

    === 잘못 설치한 가이드 ===

    책보고 따라하다가 제대로 안되서 삭제를 하려고 하니 삭제가 안된다....

    중요한점은 ... 쿠버네티스를 죽이는 방법이 보이지 않아서 한참을 헤맸다....

    결론은 kube-down 명령어를 사용하는 것이다.

    설치한 쿠버네티스를 삭제하고, minikube를 설치하도록 하려한다.

    ====================

    운영체제 CentOS 7

    yum update
    
    ## 파이썬과 curl 설치
    yum install python
    yum install curl
    
    ## gcloud SDK 설치
    curl https://sdk.cloud.google.com | bash
    
    ## === Session 재시작 ===
    gcloud auth login

    gcloud를 하면 브라우저 url이 나오고 google 계정 인증을 하면 코드를 준다.

    코드를 복사해서 다음과 같이 붙여 넣어주면 로그인 완료

    설정완료

    기본 프로젝트가 설정되겠지만, 다음 커맨드를 사용해서 확인한다.

    # gcloud config list project
    [core]
    project (unset)
    
    Your active configuration is: [default]
    
    # gcloud alpha projects list
    PROJECT_ID                   NAME                  PROJECT_NUMBER
    cloudnaturallanguage-214714  cloudNaturalLanguage  <project_number1>
    mapfor-272109                mapfor                <project_number2>
    # gcloud config set project jwi
    Updated property [core/project].
    WARNING: You do not appear to have access to project [jwi] or it does not exist.
    # curl -sS https://get.k8s.io | bash
    # kubernetes/cluster/kube-up.sh
    ... Starting cluster in us-central1-b using provider gce
    ... calling verify-prereqs
    missing required gcloud component "alpha"
    Try running `gcloud components install alpha`
    missing required gcloud component "beta"
    Try running `gcloud components install beta`
    
    # gcloud components install alpha
    # gcloud components install beta
    

     

    Cluster validation succeeded
    Done, listing cluster services:
    
    Kubernetes master is running at https://xxx.xxx.xxx.xxx
    GLBCDefaultBackend is running at https://xxx.xxx.xxx.xxx/api/v1/namespaces/kube-system/services/default-http-backend:http/proxy
    CoreDNS is running at https://xxx.xxx.xxx.xxx/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
    kubernetes-dashboard is running at https://xxx.xxx.xxx.xxx/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy
    Metrics-server is running at https://xxx.xxx.xxx.xxx/api/v1/namespaces/kube-system/services/https:metrics-server:/proxy

    ===========================================================================

    정지 및 삭제

    구글링하여 다음과같은 명령어를 해봤지만 ... 쿠버네티스는 좀비마냥 계속 다시 살아났다..

    명령어를 제대로 이해못하고 쓴 문제겠지 ㅜㅜ

    # kubectl drain <node name> --delete-local-data --force --ignore-daemonsets
    # kubectl delete node <node name>
    # kubernetes/cluster/kubectl.sh cordon kubernetes-master
    # kubernetes/cluster/kubectl.sh cordon kubernetes-minion-group-b2hj
    # kubernetes/cluster/kubectl.sh cordon kubernetes-minion-group-hn4k
    # kubernetes/cluster/kubectl.sh cordon kubernetes-minion-group-mt5k
    # sudo kubeadm reset
    # kubernetes/cluster/kubectl.sh delete podx,service,svc -n kube-system
    

     

    해결법은 아주 쉬웠다. kube-down 명령어가 있었다. 끝!

    # kubernetes/cluster/kubectl.sh get nodes
    NAME                           STATUS                     ROLES    AGE     VERSION
    kubernetes-master              Ready,SchedulingDisabled   <none>   7h24m   v1.18.1
    kubernetes-minion-group-b2hj   Ready,SchedulingDisabled   <none>   7h24m   v1.18.1
    kubernetes-minion-group-hn4k   Ready,SchedulingDisabled   <none>   7h24m   v1.18.1
    kubernetes-minion-group-mt5k   Ready,SchedulingDisabled   <none>   7h24m   v1.18.1
    
    # kubernetes/cluster/kubectl.sh get pods --all-namespaces
    NAMESPACE     NAME                                        READY   STATUS    RESTARTS   AGE
    kube-system   coredns-7876554b79-l9n6z                    0/1     Pending   0          5m
    kube-system   etcd-empty-dir-cleanup-kubernetes-master    1/1     Running   0          5m
    kube-system   etcd-server-events-kubernetes-master        1/1     Running   0          4m59s
    kube-system   etcd-server-kubernetes-master               1/1     Running   0          4m59s
    kube-system   event-exporter-v0.3.1-66674d5995-qt97k      0/1     Pending   0          4m59s
    kube-system   fluentd-gcp-scaler-54b85fcc78-ksf27         0/1     Pending   0          4m59s
    kube-system   fluentd-gcp-v3.2.0-dxvcn                    1/1     Running   0          4m55s
    kube-system   fluentd-gcp-v3.2.0-jc675                    1/1     Running   0          4m53s
    kube-system   fluentd-gcp-v3.2.0-rg6ht                    1/1     Running   0          4m50s
    kube-system   fluentd-gcp-v3.2.0-x54kc                    1/1     Running   0          4m55s
    kube-system   kube-addon-manager-kubernetes-master        1/1     Running   0          4m58s
    kube-system   kube-apiserver-kubernetes-master            1/1     Running   0          4m58s
    kube-system   kube-controller-manager-kubernetes-master   1/1     Running   0          4m58s
    kube-system   kube-dns-autoscaler-579dbcdc47-kkh8r        0/1     Pending   0          4m58s
    kube-system   kube-proxy-kubernetes-minion-group-b2hj     1/1     Running   0          4m57s
    kube-system   kube-proxy-kubernetes-minion-group-hn4k     1/1     Running   0          4m57s
    kube-system   kube-proxy-kubernetes-minion-group-mt5k     1/1     Running   0          4m57s
    kube-system   kube-scheduler-kubernetes-master            1/1     Running   0          4m57s
    kube-system   kubernetes-dashboard-864d864f44-5lr4d       0/1     Pending   0          4m57s
    kube-system   l7-default-backend-f947d4dd5-9xxpw          0/1     Pending   0          4m57s
    kube-system   l7-lb-controller-kubernetes-master          1/1     Running   2          4m56s
    kube-system   metrics-server-v0.3.6-7d85574868-q8xfd      0/2     Pending   0          4m56s
    kube-system   volume-snapshot-controller-0                0/1     Pending   0          4m56s
    
    # kubernetes/cluster/kube-down.sh
    # kubernetes/cluster/kubectl.sh get pods --all-namespaces
    error: no configuration has been provided, try setting KUBERNETES_MASTER environment variable
    # kubernetes/cluster/kubectl.sh get nodes
    error: no configuration has been provided, try setting KUBERNETES_MASTER environment variable

     

    댓글

Designed by Gintire