> ## Documentation Index
> Fetch the complete documentation index at: https://docs.galadriel.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Kubeconfig

> Get the kubeconfig for a lease to access the Kubernetes cluster

## Path Parameters

<ParamField path="lease_id" type="string" required>
  The lease ID
</ParamField>

## Response

Returns a Kubernetes config file in YAML format that can be used with `kubectl`.

<RequestExample>
  ```bash cURL theme={null}
  curl https://api.galadriel.com/v1/leases/lse_xyz123/kubeconfig \
    -H "Authorization: Bearer YOUR_API_TOKEN" \
    > ~/.kube/galadriel-lse-xyz123.conf

  # Use with kubectl
  export KUBECONFIG=~/.kube/galadriel-lse-xyz123.conf
  kubectl get nodes
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.galadriel.com/v1/leases/lse_xyz123/kubeconfig",
      headers={"Authorization": "Bearer YOUR_API_TOKEN"}
  )

  kubeconfig = response.text

  # Save to file
  with open("kubeconfig.yaml", "w") as f:
      f.write(kubeconfig)

  print("Kubeconfig saved to kubeconfig.yaml")
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://api.galadriel.com/v1/leases/lse_xyz123/kubeconfig',
    {
      headers: {
        'Authorization': 'Bearer YOUR_API_TOKEN'
      }
    }
  );

  const kubeconfig = await response.text();

  // Save to file or use in your application
  console.log('Kubeconfig retrieved successfully');
  ```
</RequestExample>

<ResponseExample>
  ```yaml Response theme={null}
  apiVersion: v1
  kind: Config
  clusters:
  - cluster:
      certificate-authority-data: LS0tLS1CRUdJTi...
      server: https://api.galadriel.com
    name: galadriel-lse-xyz123
  contexts:
  - context:
      cluster: galadriel-lse-xyz123
      namespace: customer-alice-lse-xyz123
      user: alice
    name: galadriel-lse-xyz123
  current-context: galadriel-lse-xyz123
  users:
  - name: alice
    user:
      token: eyJhbGciOiJSUzI1NiIsImtpZCI6IjEyMyJ9...
  ```
</ResponseExample>

## Usage

Once you have the kubeconfig, you can use standard Kubernetes tools:

```bash theme={null}
# Set as current context
export KUBECONFIG=~/.kube/galadriel-lse-xyz123.conf

# View nodes
kubectl get nodes

# Deploy workloads
kubectl apply -f job.yaml

# Check GPU availability
kubectl describe nodes | grep nvidia.com/gpu
```
