# Using Remote Kubernetes

### Requirements

To use Garden to deploy to and test in a remote Kubernetes cluster you'll need to configure the `kubernetes` provider. This requires:

* A Kubernetes cluster (obviously).
* Permissions to create Namespaces and to create Deployments, Daemonsets, Services and Ingresses within the Namespaces created.
* A container registry that Garden can push images to and that your cluster can pull images from.
* Ingress and DNS set up.

You can follow our [step-by-step Kubernetes tutorial](/tutorials/remote-k8s.md) for setting these up if you haven't done so already. In general there are a lot of ways to create these resources so feel free to use whatever approach you find most useful.

In any case, you'll need the following values at hand to configure the provider:

* The context for your Kubernetes cluster ([see tutorial step 1](/tutorials/remote-k8s/create-cluster.md)).
* The name(s) and namespace(s) of the ImagePullSecret(s) used by your cluster ([see tutorial step 2](/tutorials/remote-k8s/configure-registry.md)).
* The hostname for your services ([see tutorial step 3](/tutorials/remote-k8s/ingress-and-dns.md)).
* A TLS secret (optional) ([see tutorial step 3](/tutorials/remote-k8s/ingress-and-dns.md)).

### Provider configuration

When you have these values you can configure the `kubernetes` provider like so:

```yaml
apiVersion: garden.io/v2
kind: Project

environments:
  - name: remote

providers:
  - name: kubernetes
    environments: [remote]
    imagePullSecrets:
      - name: <THE IMAGE PULL SECRET FROM TUTORIAL STEP 2>
        namespace: <THE IMAGE PULL SECRET NAMESPACE FROM TUTORIAL STEP 2>
    deploymentRegistry:
      hostname: <THE REGISTRY HOSTNAME CONFIGURED IN TUTORIAL STEP 2>
      namespace: <THE REGISTRY NAMESPACE CONFIGURED INTUTORIAL  STEP 2>
    context: <THE KUBE CONTEXT FROM TUTORIAL  STEP 1>
    buildMode: cluster-buildkit
    defaultHostname: <THE HOSTNAME FROM TUTORIAL STEP 3>
```

Once you have this configured you can start adding actions for deploying K8s resources, installing Helm charts, running tests, and more in your remote cluster.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.garden.io/using-garden-with/kubernetes/remote-kubernetes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
