[Yandex Cloud documentation](../../index.md) > [Yandex Cloud Stackland](../index.md) > [Tutorials](index.md) > Setting up external access to a pod in a cluster

# Setting up external access to a pod in a cluster

Stackland allows users to run their own applications in a cluster and create external access to them. In this guide, we will show you an example of creating external access to an HTML page in a cluster.

## Getting started {#before-begin}

1. If the project does not exist yet, create it: `kubectl create namespace <project_name>`.
1. Select a lin for external access, e.g., `test.<cluster domain>`.

    You can get the cluster domain using `kubectl get platformenvironments main -o jsonpath='{.status.clusterDomain}'`, if required.

## How to create external access {#how-to}

### Step 1: Create an ingress resource {#create-ingress}

1. Create a file of the `Ingress` resource, e.g., using the `touch ingress.yaml` command.
1. Open the file and paste the configuration below into it:

    ```yaml
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      annotations:
        cert-manager.io/cluster-issuer: stackland-default
      name: test-stackland-ingress
      namespace: <project name>
    spec:
      ingressClassName: stackland-default
      rules:
      - host: <external link>
        http:
          paths:
          - backend:
              service:
                name: test-stackland-service
                port:
                  number: 5556
            path: /
            pathType: Prefix
      tls:
      - hosts:
        - <external link>
        secretName: test-stackland-tls
    ```

1. Provide the following in the parameter:

    * `metadata.namespace`: Project name.
    * `spec.rules[0].host`: External access link.
    * `spec.tls[0].hosts[0]`: External access link.

1. Apply the `kubectl apply -f ingress.yaml` manifest.

### Step 2: Create an HTML page {#create-HTML}

1. Create a file of the `ConfigMap` resource, e.g., using the `touch configmap.yaml` command.
1. Open the file and paste the configuration below into it:

    ```yaml
    apiVersion: v1
    data:
      index.html: "<!DOCTYPE html>\n<html>\n<head>\n    <title>Stackland test</title>\n    <meta charSet=\"UTF-8\"/>\n</head>\n<body>\n    <h1>Stackland external access test</h1>\n    <p>This page is used to test external access to Stackland</p>\n</body>\n</html>\n"
    kind: ConfigMap
    metadata:
      name: test-stackland-html
      namespace: <project name>
    ```

1. Provide the project name in the `metadata.namespace` parameter.
1. Apply the manifest: `kubectl apply -f configmap.yaml`.

### Step 3: Create a deployment resource for the HTML page {#create-deployment}

1. Create a file of the `Deployment` resource, e.g., using the `touch deployment.yaml` command.
1. Open the file and paste the configuration below into it:

    ```yaml
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: test-stackland
      namespace: <project name>
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: test-stackland-service
      template:
        metadata:
          labels:
            app: test-stackland-service
        spec:
          containers:
          - image: nginx:alpine
            name: nginx
            ports:
            - containerPort: 80
            volumeMounts:
            - mountPath: /usr/share/nginx/html
              name: html
          volumes:
          - configMap:
              name: test-stackland-html
            name: html
    ```

1. Provide the project name in the `metadata.namespace` parameter.
1. Apply the manifest: `kubectl apply -f deployment.yaml`.

### Step 4: Create a service resource for the HTML page {#create-service}

1. Create a file of the `Service` resource, e.g., using the `touch service.yaml` command.
1. Open the file and paste the configuration below into it:

    ```yaml
    apiVersion: v1
    kind: Service
    metadata:
      name: test-stackland-service
      namespace: <project name>
    spec:
      ports:
      - port: 5556
        targetPort: 80
      selector:
        app: test-stackland-service
    ```

1. Provide the project name in the `metadata.namespace` parameter.
1. Apply the manifest: `kubectl apply -f service.yaml`.

### Step 5: Test access {#check-access}

Use your web browser to open the external access link you selected. You should see the test HTML page there.