Difference between revisions of "~/.kube/config"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
 
(55 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
  [[~/.kube/]]config
 
  [[~/.kube/]]config
 +
[[kubectl --kubeconfig]] [[~/.kube/]]yourclusterconfig
  
 
  [[apiVersion]]: v1
 
  [[apiVersion]]: v1
 
  clusters: null
 
  clusters: null
  contexts: null
+
  [[Kubernetes contexts|contexts]]: null
 
  current-context: ""
 
  current-context: ""
  kind: Config
+
  [[kind: Config]]
 
  preferences: {}
 
  preferences: {}
  users: null
+
  [[users:]] null
  
== Example ==
+
 
<pre>
+
== Configure ==
apiVersion: v1
+
* AWS: <code>[[aws eks update-kubeconfig]] --name my-eks-cluster-name</code>
clusters:
+
* GCP: <code>[[gcloud container clusters get-credentials]] [[MyClusterName]]</code>
- cluster:
+
 
    certificate-authority-data: LS0tLS1CRUdJTiDATAREMOVEDCg==
+
== Examples ==
    server: https://00AXXXXXXXXXX1B.gr7.us-east-2.eks.amazonaws.com
+
 
  name: arn:aws:eks:us-east-2:123455:cluster/education-eks-Ry318DCv
+
apiVersion: v1  
contexts:
+
clusters:
- context:
+
- cluster:
    cluster: arn:aws:eks:us-east-2:123456:cluster/education-eks-Ry318DCv
+
    certificate-authority-data: LS0tLS1CRUdJTiDATAREMOVEDCg==
    user: arn:aws:eks:us-east-2:123455:cluster/education-eks-Ry318DCv
+
    [[server:]] https://00AXXXXXXXXXX1B.gr7.us-east-2.eks.amazonaws.com
  name: arn:aws:eks:us-east-2:123456:cluster/education-eks-Ry318DCv
+
  name: arn:aws:eks:us-east-2:123455:cluster/education-eks-Ry318DCv  
current-context: arn:aws:eks:us-east-2:123456:cluster/education-eks-Ry318DCv
+
[[contexts:]]
kind: Config
+
- context:
preferences: {}
+
    cluster: arn:aws:eks:us-east-2:123456:cluster/education-eks-Ry318DCv
users:
+
    [[user]]: arn:aws:eks:us-east-2:123455:cluster/education-eks-Ry318DCv
- name: arn:aws:eks:us-east-2:123456:cluster/education-eks-Ry318DCv
+
  name: arn:aws:eks:us-east-2:123456:cluster/education-eks-Ry318DCv  
  user:
+
current-context: arn:aws:eks:us-east-2:123456:cluster/education-eks-Ry318DCv  
    exec:
+
[[kind: Config]]
      apiVersion: client.authentication.k8s.io/v1alpha1
+
 
      args:
+
{{kind config}}
      - --region
+
 
      - us-east-2
+
 
      - eks
+
=== Example ===
      - get-token
+
- name: your-cluster-name
      - --cluster-name
+
  [[user]]:
      - education-eks-Ry318DCv
+
    [[auth-provider:]]
      command: aws
+
      [[config:]]
      env:
+
        [[access-token:]] ya29.a0AVA9y1sXXXXC-z107gauQ0174
      - name: AWS_PROFILE
+
        cmd-args: [[config config-helper]] --format=json
        value: your_profile
+
        cmd-path: /Users/my-user/brew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/[[gcloud]]
</pre>
+
        expiry: "2022-08-25T15:03:28Z"
 +
        expiry-key: '{.credential.token_expiry}'
 +
        token-key: '{.credential.access_token}'
 +
      name: your-name
  
 
== Errors ==
 
== Errors ==
 
  Error: unable to describe cluster control plane: [[AccessDeniedException]]: User: arn:aws:iam::0987654321:user/YOUR_USER is not authorized to perform: eks:[[DescribeCluster]] on resource: arn:aws:eks:xx-east-2:0987654321:cluster/my-eks-cluster-name with an [[explicit deny]]
 
  Error: unable to describe cluster control plane: [[AccessDeniedException]]: User: arn:aws:iam::0987654321:user/YOUR_USER is not authorized to perform: eks:[[DescribeCluster]] on resource: arn:aws:eks:xx-east-2:0987654321:cluster/my-eks-cluster-name with an [[explicit deny]]
 +
 +
 +
[[kubectl get pods]]
 +
error: [[exec plugin]]: [[invalid apiVersion]] "[[client.authentication.k8s.io]]/[[v1alpha1]]"
 +
 +
[[aws --version]]
 +
aws-cli/1.18.147 .../...
 +
 +
[[error: You must be logged in to the server (Unauthorized)]]
 +
 +
== Activites ==
 +
* [[Merge multiple kubeconfigs]]
 +
* [[Authenticate to your Amazon EKS cluster]] <code>[[aws eks update-kubeconfig]]</code>
  
 
== Related ==
 
== Related ==
 
* https://docs.aws.amazon.com/eks/latest/userguide/create-kubeconfig.html
 
* https://docs.aws.amazon.com/eks/latest/userguide/create-kubeconfig.html
 
* <code>[[kubectl config]]</code>
 
* <code>[[kubectl config]]</code>
* <code>[[kubectl get nodes]]</code>
+
* <code>[[kubectl konfig merge]]</code>
* <code>[[kubectl get svc]]</code>
+
* <code>[[kubectl get nodes]]</code><code>[[kubectl get svc]]</code>
* [[Terraform: Kubernetes provider]]
+
* [[Terraform: Kubernetes provider]],  [[Terraform helm provider]]
* <code>[[aws eks update-kubeconfig]] --name my-eks-cluster-name</code>
+
* <code>[[aws eks get-token]]</code>
 +
* [[Connect to K8s cluster]]
 +
** AWS: <code>[[aws eks update-kubeconfig]] --name my-eks-cluster-name</code>
 +
** [[GCP]]: <code>[[gcloud container clusters get-credentials]] [[MyClusterName]]</code>
 +
* <code>[[kubectl config rename-context]]</code>
 +
* <code>kubectl auth</code>
 +
* <code>[[kubectl config view --flatten]]</code>
 +
* <code>[[rancher cluster kubeconfig]]</code>
 +
* [[Install kubectl]]
 +
* <code>[[kubectl --context]]</code>
 +
* <code>[[az aks get-credentials]]</code>
  
 
== See also ==
 
== See also ==
* {{kubectl}}
+
* {{kubectl config}}
* {{Terraform EKS}}
+
* {{tf EKS}}
  
 
[[Category:kubectl]]
 
[[Category:kubectl]]

Latest revision as of 14:33, 28 July 2024

~/.kube/config
kubectl --kubeconfig ~/.kube/yourclusterconfig
apiVersion: v1
clusters: null
contexts: null
current-context: ""
kind: Config
preferences: {}
users: null


Configure[edit]

Examples[edit]

apiVersion: v1 
clusters:
- cluster:
    certificate-authority-data: LS0tLS1CRUdJTiDATAREMOVEDCg==
    server: https://00AXXXXXXXXXX1B.gr7.us-east-2.eks.amazonaws.com
  name: arn:aws:eks:us-east-2:123455:cluster/education-eks-Ry318DCv 
contexts:
- context:
    cluster: arn:aws:eks:us-east-2:123456:cluster/education-eks-Ry318DCv
    user: arn:aws:eks:us-east-2:123455:cluster/education-eks-Ry318DCv
  name: arn:aws:eks:us-east-2:123456:cluster/education-eks-Ry318DCv 
current-context: arn:aws:eks:us-east-2:123456:cluster/education-eks-Ry318DCv 
kind: Config
  kind: Config
 preferences: {}
 users:
 - name: arn:aws:eks:us-east-2:123456:cluster/education-eks-Ry318DCv
  [[user:]]
    exec:
      apiVersion: client.authentication.k8s.io/v1alpha1
      args:
      - --region
      - us-east-2
      - eks
      - get-token
      - --cluster-name
      - education-eks-Ry318DCv
      command: aws
      env:
      - name: AWS_PROFILE
        value: your_aws_profile


Example[edit]

- name: your-cluster-name
  user:
    auth-provider:
      config:
        access-token: ya29.a0AVA9y1sXXXXC-z107gauQ0174
        cmd-args: config config-helper --format=json
        cmd-path: /Users/my-user/brew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/gcloud
        expiry: "2022-08-25T15:03:28Z"
        expiry-key: '{.credential.token_expiry}'
        token-key: '{.credential.access_token}'
      name: your-name

Errors[edit]

Error: unable to describe cluster control plane: AccessDeniedException: User: arn:aws:iam::0987654321:user/YOUR_USER is not authorized to perform: eks:DescribeCluster on resource: arn:aws:eks:xx-east-2:0987654321:cluster/my-eks-cluster-name with an explicit deny


kubectl get pods
error: exec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1"
aws --version
aws-cli/1.18.147 .../...
error: You must be logged in to the server (Unauthorized)

Activites[edit]

Related[edit]

See also[edit]

Advertising: