[Mock3_8] 8. kubeconfig

유유·2023년 1월 31일
0

CKA

목록 보기
8/19

https://kubernetes.io/ko/docs/concepts/configuration/organize-cluster-access-kubeconfig/

A kubeconfig file called super.kubeconfig has been created under /root/CKA. There is something wrong with the configuration. Troubleshoot and fix it.

  • Fix /root/CKA/super.kubeconfig
    Verify host and port for kube-apiserver are correct. Open the super.kubeconfig
    controlplane ~/CKA ➜  kubectl config view
    
    ---
    apiVersion: v1
    clusters:
    - cluster:
        certificate-authority-data: DATA+OMITTED
        server: https://controlplane:6443
      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: DATA+OMITTED
        client-key-data: DATA+OMITTED
    in vi editor. Change the 9999 port to 6443 and run the below command to verify: 왜냐면 kubectl config view 값이랑 맞춰 줘야 하니까 kubectl cluster-info --kubeconfig=/root/CKA/super.kubeconfig
    kubectl cluster-info -h
    
    Display addresses of the control plane and services with label
    kubernetes.io/cluster-service=true. To further debug and diagnose cluster
    problems, use 'kubectl cluster-info dump'.
    
    Examples:
      # Print the address of the control plane and cluster services
      kubectl cluster-info
    
    Available Commands:
      dump          Dump relevant information for debugging and diagnosis
    
    Usage:
      kubectl cluster-info [flags] [options]
    
    Use "kubectl <command> --help" for more information about a given command.
    Use "kubectl options" for a list of global command-line options (applies to all
    commands).
    
    --kubeconfig='':
            Path to the kubeconfig file to use for CLI requests.
profile
하이

0개의 댓글