반응형

 

kubectl api-resources 명령어를 통해 모든 리소스 조회 가능하다.

root@master:/# kubectl api-resources
NAME                              SHORTNAMES         APIVERSION                             NAMESPACED   KIND
bindings                                             v1                                     true         Binding
componentstatuses                 cs                 v1                                     false        ComponentStatus
configmaps                        cm                 v1                                     true         ConfigMap
endpoints                         ep                 v1                                     true         Endpoints
events                            ev                 v1                                     true         Event
limitranges                       limits             v1                                     true         LimitRange
namespaces                        ns                 v1                                     false        Namespace
nodes                             no                 v1                                     false        Node
persistentvolumeclaims            pvc                v1                                     true         PersistentVolumeClaim
persistentvolumes                 pv                 v1                                     false        PersistentVolume
pods                              po                 v1                                     true         Pod
podtemplates                                         v1                                     true         PodTemplate
replicationcontrollers            rc                 v1                                     true         ReplicationController
resourcequotas                    quota              v1                                     true         ResourceQuota
secrets                                              v1                                     true         Secret
serviceaccounts                   sa                 v1                                     true         ServiceAccount
services                          svc                v1                                     true         Service
mutatingwebhookconfigurations                        admissionregistration.k8s.io/v1        false        MutatingWebhookConfiguration
validatingwebhookconfigurations                      admissionregistration.k8s.io/v1        false        ValidatingWebhookConfiguration
customresourcedefinitions         crd,crds           apiextensions.k8s.io/v1                false        CustomResourceDefinition
apiservices                                          apiregistration.k8s.io/v1              false        APIService
controllerrevisions                                  apps/v1                                true         ControllerRevision
daemonsets                        ds                 apps/v1                                true         DaemonSet
deployments                       deploy             apps/v1                                true         Deployment
replicasets                       rs                 apps/v1                                true         ReplicaSet
statefulsets                      sts                apps/v1                                true         StatefulSet
applications                      app,apps           argoproj.io/v1alpha1                   true         Application
applicationsets                   appset,appsets     argoproj.io/v1alpha1                   true         ApplicationSet
appprojects                       appproj,appprojs   argoproj.io/v1alpha1                   true         AppProject
selfsubjectreviews                                   authentication.k8s.io/v1               false        SelfSubjectReview
tokenreviews                                         authentication.k8s.io/v1               false        TokenReview
localsubjectaccessreviews                            authorization.k8s.io/v1                true         LocalSubjectAccessReview
selfsubjectaccessreviews                             authorization.k8s.io/v1                false        SelfSubjectAccessReview
selfsubjectrulesreviews                              authorization.k8s.io/v1                false        SelfSubjectRulesReview
subjectaccessreviews                                 authorization.k8s.io/v1                false        SubjectAccessReview
horizontalpodautoscalers          hpa                autoscaling/v2                         true         HorizontalPodAutoscaler
cronjobs                          cj                 batch/v1                               true         CronJob
jobs                                                 batch/v1                               true         Job
certificatesigningrequests        csr                certificates.k8s.io/v1                 false        CertificateSigningRequest
leases                                               coordination.k8s.io/v1                 true         Lease
endpointslices                                       discovery.k8s.io/v1                    true         EndpointSlice
events                            ev                 events.k8s.io/v1                       true         Event
flowschemas                                          flowcontrol.apiserver.k8s.io/v1beta3   false        FlowSchema
prioritylevelconfigurations                          flowcontrol.apiserver.k8s.io/v1beta3   false        PriorityLevelConfiguration
ingressclasses                                       networking.k8s.io/v1                   false        IngressClass
ingresses                         ing                networking.k8s.io/v1                   true         Ingress
networkpolicies                   netpol             networking.k8s.io/v1                   true         NetworkPolicy
runtimeclasses                                       node.k8s.io/v1                         false        RuntimeClass
poddisruptionbudgets              pdb                policy/v1                              true         PodDisruptionBudget
clusterrolebindings                                  rbac.authorization.k8s.io/v1           false        ClusterRoleBinding
clusterroles                                         rbac.authorization.k8s.io/v1           false        ClusterRole
rolebindings                                         rbac.authorization.k8s.io/v1           true         RoleBinding
roles                                                rbac.authorization.k8s.io/v1           true         Role
priorityclasses                   pc                 scheduling.k8s.io/v1                   false        PriorityClass
csidrivers                                           storage.k8s.io/v1                      false        CSIDriver
csinodes                                             storage.k8s.io/v1                      false        CSINode
csistoragecapacities                                 storage.k8s.io/v1                      true         CSIStorageCapacity
storageclasses                    sc                 storage.k8s.io/v1                      false        StorageClass
volumeattachments                                    storage.k8s.io/v1                      false        VolumeAttachment

 

 

이 명령어를 잘 이용하면 각 서비스에 대한 yaml파일들을 백업할 수 있다.

#!/bin/sh

DIR=/k8s-bak/resouruces # 경로 입력

mkdir -p 

for NS in $(kubectl get ns --no-headers | awk '{ print $1 }') # 모든 Namespace 조회
do
    mkdir -p ${DIR}/${NS} # 각 Namespace 별 폴더 생성
    for RESOURCE in $(kubectl api-resources --no-headers | awk '{ print $1 }') # 리소스 조회
    do
        kubectl get ${RESOURCE} -n ${NS} -o yaml > ${DIR}/${NS}/${RESOURCE}.yaml # YAML 백업
    done
done

 

실행결과

root@master:~# ./bak.yaml

root@master:/k8s-bak/resources# ls
argocd  default  ingress-nginx  kube-node-lease  kube-public  kube-system

root@master:/k8s-bak/resources# cd argocd/

root@master:/k8s-bak/resources/argocd# ls
apiservices.yaml                 mutatingwebhookconfigurations.yaml
applicationsets.yaml             namespaces.yaml
applications.yaml                networkpolicies.yaml
appprojects.yaml                 nodes.yaml
bindings.yaml                    persistentvolumeclaims.yaml
certificatesigningrequests.yaml  persistentvolumes.yaml
clusterrolebindings.yaml         poddisruptionbudgets.yaml
clusterroles.yaml                pods.yaml
componentstatuses.yaml           podtemplates.yaml
configmaps.yaml                  priorityclasses.yaml
controllerrevisions.yaml         prioritylevelconfigurations.yaml
cronjobs.yaml                    replicasets.yaml
csidrivers.yaml                  replicationcontrollers.yaml
csinodes.yaml                    resourcequotas.yaml
csistoragecapacities.yaml        rolebindings.yaml
customresourcedefinitions.yaml   roles.yaml
daemonsets.yaml                  runtimeclasses.yaml
deployments.yaml                 secrets.yaml
endpointslices.yaml              selfsubjectaccessreviews.yaml
endpoints.yaml                   selfsubjectreviews.yaml
events.yaml                      selfsubjectrulesreviews.yaml
flowschemas.yaml                 serviceaccounts.yaml
horizontalpodautoscalers.yaml    services.yaml
ingressclasses.yaml              statefulsets.yaml
ingresses.yaml                   storageclasses.yaml
jobs.yaml                        subjectaccessreviews.yaml
leases.yaml                      tokenreviews.yaml
limitranges.yaml                 validatingwebhookconfigurations.yaml
localsubjectaccessreviews.yaml   volumeattachments.yaml
반응형
반응형

kubectl 도구를 이용하여 Windows에서 기타 서버에 설치되어있는 k8s cluster를 사용할 수 있으며,

k8s 클러스터가 여러개일 경우에도 선택하여 사용가능하다.

 

1. k8s 설치

Window에 Terminal 또는 Powershell을 열어 아래의 명령어를 통해 kubectl을 다운받는다.

curl.exe -LO "https://dl.k8s.io/release/v1.28.4/bin/windows/amd64/kubectl.exe"

 

다운 후 Path에 등록하여도 되고 직접 kubectl 설치되어있는 폴더 호출 하여 사용해도 무관.

# C드라이브 test폴더에서 kubectl 파일 다운받았을 경우
C:\test> ./kubectl

 

 

2. k8s config 파일 복사

서버에 있는 k8s config파일의 내용을 복사한다.

cat ~/.kube/config

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCRXhNelV4TlROYUZ3MHpNekE0TVRneE16VTJOVE5hTUJVeApFekFSQmdOVkJBTVRDbXQxWW1WeWJtVjBaWE13Z2dFaU1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQkR3QXdnZ0VLCkFvSUJBUURmZTZSREhXZE90Q25qczZnNHFESVprZHFzR2ZRUEE5MXlWYS9LN3AwcTZIRllvRzRQcGZHMkdUeFIKWi9HeXFqU3ZIS01KYWo1WUIvdHJ1TEtrMnoreTFGZXp0eHJFc1JkVi96UXlNOENrcGZVd1FhV2dNMGhSUTF3NgpKcTZGOHhsMlBSaDFlRjJ1eG9YT0pPOFFGam1EV2lUWVQrNEhTL0dRRE5hTlYvNlAxOXllM2VNQWhyZndQeU4xCkJKWXNwRnBTRFJLMTNpNG1IYTk3ZS9WMU9iQkFaQlJNZHhYc3FsaHQvaDR3UWFaRGF4N05tb2huVC9QOGlJTzYKamdtMC82cDBiRmhaaU5nam10TFkwdW9sd2R5Z1JyV1laSCtsclJ6b3FmbW0wUzRieEwrNC9lUXVCeFNlYzBmQwozWjlTaFJPaitiVkt6MFdmRG5PUEQ4S29kTmJqQWdNQkFBR2pXVEJYTUE0R0ExVWREd0VCL3dRRUF3SUNwREFQCkJnTlZIUk1CQWY4RUJUQURBUUgvTUIwR0ExVWREZ1FXQkJSNHR3RnVGY2JTN3VxZXhPcFdCdTEreTFUU0x6QVYKQmdOVkhSRUVEakFNZ2dwcmRXSmxjbTVsZEdWek1BMEdDU3FHU0liM0RRRUJDd1VBQTRJQkFRQUJpSXNhK0EvNgpkdzIzWVNhTm8wU0FaQ3ZUckc1eE1wVWtpRktDcXd0eXU5OFhOR29JNWlhY3pyMllsS2ZueGh6eVNzSFJuWTBNCnZUT3k3aUp2ZGhseldqUlUvcGZMS0hRMVZuSkZ6ZzQ1NDhrdE5MUHQ3eVFTL25HelJDZnJhZGhzc0FKTzJMc1cKTnRxVm5kM3hibVpFTDREamM4ZWNmYVJZMHJTMm9yQ3RoZzZQZFZhMTdQaWlWTk1zS0hGSnJpMVRPdEY5VzdKYQpNQkRLN2ttL2syZThnRmJPYzhlZHc5VGVmS09QTFBLenN6NXVzbWRCNnVyNnZxRFlUYWhtVi9UV2NrQW04aFd6ClU4bkxDcEE1VVllV3hkbTBJSGU2L0NOUmNEeXQzUEtOQTlMZm5zeHcxZjh5c24zSElSSTc2REhyVE9OK3lQUjQKRFpacjI5YjRsWkVtCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
    server: https://192.168.1.1:6443
  name: dev-k8s
contexts:
- context:
    cluster: dev-k8s
    user: pangyeon
  name: pangyeon-dev
current-context:  pangyeon-dev
kind: Config
preferences: {}
users:
- name: pangyeon
  user:
    client-certificate-data: LS0tLS1CRUdJTiBSUZJQDQWdtZ0F3SUJBZ0lJSGpubTVYZWxsbk13RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TXpBNE1qRXhNelV4TlROYUZ3MHlOREE0TWpBeE16VTJOVFphTURReApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sa3dGd1lEVlFRREV4QnJkV0psY201bGRHVnpMV0ZrCmJXbHVNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQTJ0QVJiWnBiUmNsdFZXRjAKaldFVCt4ZlJ6NC9naG0rYlhC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CtMcG8yeWhBZ1hVNm9SMDlNdG56ZUo0UGhBTzI5WQo1ejNiZHp5Q1RNZlN4RUYweWNOL21yZnI1N2VGVk51d1ZnUkVySWxkVGw5NkRaVENXS2ZDb0h3PQotLS0tLUVORCBSU0EgUFJJVkFURSBS0tLQo=

 

 

3. 복사한 파일 이동 및 조회

아래 두가지 방법으로 사용가능

 

3.1 Windows 계정 폴더로 이동

C:\Users\본인계정\  으로 이동하여 .kube 폴더 생성 후 아래에 config파일 이동

 

C:\Users\본인계정\.kube\config 에 파일이 있을 경우 바로 사용가능하다.

# C드라이브 test에 kubectl 파일이 있는 경우
PS C:\test> ./kubectl get pods -A
NAMESPACE       NAME                                                READY   STATUS        RESTARTS       AGE
ingress-nginx   ingress-nginx-controller-6544f7745b-z4lsr           1/1     Running       1 (52m ago)    24h
kube-system     coredns-5dd5756b68-2tl8x                            1/1     Terminating   0              1d
kube-system     coredns-5dd5756b68-6b55b                            1/1     Terminating   0              1d
kube-system     coredns-5dd5756b68-7fxrc                            1/1     Running       8 (52m ago)    1d
kube-system     coredns-5dd5756b68-h982d                            1/1     Running       9 (52m ago)    1d
kube-system     etcd-ubuntu                                         1/1     Running       0              1d
kube-system     kube-apiserver-ubuntu                               1/1     Running       0              1d
kube-system     kube-controller-manager-ubuntu                      1/1     Running       0              1d
kube-system     kube-proxy-2sngh                                    1/1     Running       9 (52m ago)    1d
kube-system     kube-proxy-mmsbf                                    1/1     Running       10 (52m ago)   1d
kube-system     kube-proxy-zh22k                                    1/1     Running       0              1d
kube-system     kube-scheduler-ubuntu                               1/1     Running       0              1d
kube-system     weave-net-94f8g                                     2/2     Running       24 (52m ago)   1d
kube-system     weave-net-gszsj                                     2/2     Running       30 (51m ago)   1d
kube-system     weave-net-hxknh                                     2/2     Running       1 (99d ago)    1d

 

 

3.2 사용하기 편한곳에 config 파일두고 kubectl --kubeconfig 옵션을 통해 사용

# C드라이브 내 test폴더에 config파일이 있을 경우
./kubectl get pods -A --kubeconfig=C:\test\config
NAMESPACE       NAME                                                READY   STATUS        RESTARTS       AGE
ingress-nginx   ingress-nginx-controller-6544f7745b-z4lsr           1/1     Running       1 (52m ago)    24h
kube-system     coredns-5dd5756b68-2tl8x                            1/1     Terminating   0              1d
kube-system     coredns-5dd5756b68-6b55b                            1/1     Terminating   0              1d
kube-system     coredns-5dd5756b68-7fxrc                            1/1     Running       8 (52m ago)    1d
kube-system     coredns-5dd5756b68-h982d                            1/1     Running       9 (52m ago)    1d
kube-system     etcd-ubuntu                                         1/1     Running       0              1d
kube-system     kube-apiserver-ubuntu                               1/1     Running       0              1d
kube-system     kube-controller-manager-ubuntu                      1/1     Running       0              1d
kube-system     kube-proxy-2sngh                                    1/1     Running       9 (52m ago)    1d
kube-system     kube-proxy-mmsbf                                    1/1     Running       10 (52m ago)   1d
kube-system     kube-proxy-zh22k                                    1/1     Running       0              1d
kube-system     kube-scheduler-ubuntu                               1/1     Running       0              1d
kube-system     weave-net-94f8g                                     2/2     Running       24 (52m ago)   1d
kube-system     weave-net-gszsj                                     2/2     Running       30 (51m ago)   1d
kube-system     weave-net-hxknh                                     2/2     Running       1 (99d ago)    1d

 

 

4. k8s 클러스터가 여러개일경우

config 파일에 등록한다.

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURCVENDQWUyZ0F3SUJBZ0lJTC9XdXZlY1ZxL013RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TXpBNE1qRXhNelV4TlROYUZ3MHpNekE0TVRneE16VTJOVE5hTUJVeApFekFSQmdOVkJBTVRDbXQxWW1WeWJtVjBaWE13Z2dFaU1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQkR3QXdnZ0VLCkFvSUJBUURmZTZSREhXZE90Q25qczZnNHFESVprZHFzR2ZRUEE5MXlWYS9LN3AwcTZIRllvRzRQcGZHMkdUeFIKWi9He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K0EvNgpkdzIzWVNhTm8wU0FaQ3ZUckc1eE1wVWtpRktDcXd0eXU5OFhOR29JNWlhY3pyMllsS2ZueGh6eVNzSFJuWTBNCnZUT3k3aUp2ZGhseldqUlUvcGZMS0hRMVZuSkZ6ZzQ1NDhrdE5MUHQ3eVFTL25HelJDZnJhZGhzc0FKTzJMc1cKTnRxVm5kM3hibVpFTDREamM4ZWNmYVJZMHJTMm9yQ3RoZzZQZFZhMTdQaWlWTk1zS0hGSnJpMVRPdEY5VzdKYQpNQkRLN2ttL2syZThnRmJPYzhlZHc5VGVmS09QTFBLenN6NXVzbWRCNnVyNnZxRFlUYWhtVi9UV2NrQW04aFd6ClU4bkxDcEE1VVllV3hkbTBJSGU2L0NOUmNEeXQzUEtOQTlMZm5zeHcxZjh5c24zSElSSTc2REhyVE9OK3lQUjQKRFpacjI5YjRsWkVtCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
    server: https://192.168.2.1:6443
  name: stg-k8s
contexts:
- context:
    cluster: dev-k8s
    user: pangyeon-dev
  name: pangyeon-dev
- context:
    cluster: stg-k8s
    user: pangyeon-stg
  name: pangyeon-stg
current-context: pangyeon-dev
kind: Config
preferences: {}
users:
- name: pangyeon-dev
  user:
    client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURJVENDQWdtZ0F3SUJBZ0lJSGpubTVYZWxsbk13RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TXpBNE1qRXhNelV4TlROYUZ3MHlOREE0TWpBeE16VTJOVFphTURReApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sa3dGd1lEVlFRREV4QnJkV0psY201bGRHVnpMV0ZrCmJXbHVNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQTJ0QVJiWnBiUmNsdFZXRjAKaldFVCt4ZlJ6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BMT0lta1pGCndHSmJoT1lFcDhXcktZalZQNzJXSmg4bXhLVFBUSVhFNTZKSzZIL1pBb0dCQU0yQXUxaHhqdVU3M1IyMGxRK00KTkRyL3hrN3l4QktVUTBOZkFWWU5tUThLU25kanJYSnQyVnFyNi80cStHZ2VieDBnbmozOEJKbG9Rc1pSdUVOWgpBR2FJVy9kN2hsTkFDNFN5K3NqSGlRWmZKYVhtL2RaSEdoNkhRaFo1cnhOenZjNDNBc1BQaGp0TzBYWkt1UDVMClliY01FcHdCcHJCbmlIV0NTUEZ1MHI2bEFvR0FSUGdYUlJIZ3J2dUlDV1NYYmgwSTZMUFkwRGRtaFNtbExiK1cKMGhqMUF1Q1ZjUkc4UE04Vkc4cXdOTGdkS0d0Q0FXckw2bExwRC9lK0ZjaE9ja3dQODg4WGdvR3VMVW9oY0k4cgpqZXY3WEx6dDMzZWM3NkdIZDgrcE5sR2lBME9ObkNCdXhhOTh3eElNdDh4enhWQnBnOWhrMmZIRDkyZE1XMXFlCmJaaTB3b2tDZ1lFQTdoWUNYSXlXQkpkU3lrMnNPakVndHdLY3AwY2VxUC9sd2QwbGFya2VDU1laSEtweGY5TSsKMm93dGd6UzFTZ1pibHlvRytMQzVFRkF6cXJIK002aHdXZCtMcG8yeWhBZ1hVNm9SMDlNdG56ZUo0UGhBTzI5WQo1ejNiZHp5Q1RNZlN4RUYweWNOL21yZnI1N2VGVk51d1ZnUkVySWxkVGw5NkRaVENXS2ZDb0h3PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=

 

 

5. use-context 옵션을 통해 클러스터를 선택한다.

PS C:\test> ./kubectl config use-context pangyeon-dev
Switched to context "pangyeon-dev".

 

 

6. 선택 후 조회

./kubectl get pods -A
NAMESPACE       NAME                                                READY   STATUS        RESTARTS       AGE
ingress-nginx   ingress-nginx-controller-6544f7745b-z4lsr           1/1     Running       1 (52m ago)    24h
kube-system     coredns-5dd5756b68-2tl8x                            1/1     Terminating   0              1d
kube-system     coredns-5dd5756b68-6b55b                            1/1     Terminating   0              1d
kube-system     coredns-5dd5756b68-7fxrc                            1/1     Running       8 (52m ago)    1d
kube-system     coredns-5dd5756b68-h982d                            1/1     Running       9 (52m ago)    1d
kube-system     etcd-ubuntu                                         1/1     Running       0              1d
kube-system     kube-apiserver-ubuntu                               1/1     Running       0              1d
kube-system     kube-controller-manager-ubuntu                      1/1     Running       0              1d
kube-system     kube-proxy-2sngh                                    1/1     Running       9 (52m ago)    1d
kube-system     kube-proxy-mmsbf                                    1/1     Running       10 (52m ago)   1d
kube-system     kube-proxy-zh22k                                    1/1     Running       0              1d
kube-system     kube-scheduler-ubuntu                               1/1     Running       0              1d
kube-system     weave-net-94f8g                                     2/2     Running       24 (52m ago)   1d
kube-system     weave-net-gszsj                                     2/2     Running       30 (51m ago)   1d
kube-system     weave-net-hxknh                                     2/2     Running       1 (99d ago)    1d

 

 

참고

https://kubernetes.io/ko/docs/tasks/tools/install-kubectl-windows/

https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/

반응형
반응형

 

1. etcdctl leader 및 list 조회 명령어 입력시 Error: context deadline exceeded 발생할 경우 cacert, cert, key를 입력해준다.

# 아래 명령어 중 하나 사용
etcdctl member list --cacert="/etc/kubernetes/pki/etcd/ca.crt" --cert="/etc/kubernetes/pki/etcd/peer.crt" --key="/etc/kubernetes/pki/etcd/peer.key"
etcdctl endpoint status --cluster --cacert="/etc/kubernetes/pki/etcd/ca.crt" --cert="/etc/kubernetes/pki/etcd/peer.crt" --key="/etc/kubernetes/pki/etcd/peer.key"
or
etcdctl member list --cacert="/etc/kubernetes/pki/etcd/ca.crt" --cert="/etc/kubernetes/pki/etcd/server.crt" --key="/etc/kubernetes/pki/etcd/server.key"
etcdctl endpoint status --cluster --cacert="/etc/kubernetes/pki/etcd/ca.crt" --cert="/etc/kubernetes/pki/etcd/server.crt" --key="/etc/kubernetes/pki/etcd/server.key"

 

 

2. etcdctl 사용시 open /etc/kubernetes/pki/etcd/ca.crt: permission denied 발생할 경우

kube-system의 etcd 버전과 맞춰준다.

cat /etc/kubernetes/manifests/etcd.yaml | grep image
# image: image: registry.k8s.io/etcd:3.5.9-0 
# 위 image 버전확인 후 etcdctl 다운
# https://github.com/etcd-io/etcd/releases
curl https://storage.googleapis.com/etcd/v3.5.9/etcd-v3.5.9-linux-amd64.tar.gz -o ./etcd-v3.5.9-linux-amd64.tar.gz
반응형

+ Recent posts