---
title: "Publish a service from a Managed Kubernetes cluster to the Internet"
sidebar_label: "Publish a service to the Internet"
sidebar_position: 3
description: "How to publish a service to the Internet using Envoy Gateway"
---

import Formbricks from '@theme/MDXComponents/Formbricks'

# Publish a service from a Managed Kubernetes cluster to the Internet

1. [Check quotas](#check-quotas).
2. [Connect to the cluster](#connect-to-cluster).
3. [Create a GatewayClass](#create-gatewayclass).
4. [Create a Gateway](#create-gateway).
5. [Create an HTTPRoute](#create-httproute).

## 1. Check quotas \{#check-quotas}

Ensure that the pool has a [quota](/access-control/projects/quotas.mdx) for at least one public IP address. To do this, [view your cloud platform quota consumption](/access-control/projects/quotas.mdx#view-consumption).

## 2. Connect to the cluster \{#connect-to-cluster}

To connect to the cluster, follow the instructions in [Connect to a Managed Kubernetes cluster](/managed-kubernetes/clusters/connect-to-cluster.mdx).

## 3. Create a GatewayClass \{#create-gatewayclass}

1. Create a YAML file with a manifest for the GatewayClass object.

   Example of a GatewayClass manifest:

   ```yaml
   ---
   apiVersion: gateway.networking.k8s.io/v1
   kind: GatewayClass
   metadata:
       name: envoy-gateway
   spec:
       controllerName: gateway.envoyproxy.io/gatewayclass-controller
   ```

2. Apply the manifest:

   ```bash
   kubectl apply -f <file_name>
   ```

   Specify `<file_name>` — the name of the YAML file with the manifest to create the GatewayClass object. For example, `<gatewayclass.yaml>`.

## 4. Create a Gateway \{#create-gateway}

1. Create a YAML file with a manifest for the Gateway object.

   Example of a Gateway manifest:

   ```yaml
   ---
   apiVersion: gateway.networking.k8s.io/v1
   kind: Gateway
   metadata:
       name: external-gateway
   spec:
       gatewayClassName: envoy-gateway
       listeners:
           - name: http
             protocol: HTTP
             port: 80
   ```

2. Apply the manifest:

   ```bash
   kubectl apply -f <file_name>
   ```

   Specify `<file_name>` — the name of the YAML file with the manifest to create the Gateway object. For example, `<gateway.yaml>`.

The created load balancer will appear in the [Control Panel](https://my.selectel.ru/vpc/default/lbaas/load-balancers/): in the top menu, click **Products** and select **Cloud Servers** → section **Load Balancers** → tab **Load Balancers**.

## 5. Create an HTTPRoute \{#create-httproute}

1. Create a YAML file with a manifest for the HTTPRoute object.

   Example of an HTTPRoute manifest:

   ```yaml
   ---
   apiVersion: gateway.networking.k8s.io/v1
   kind: HTTPRoute
   metadata:
       name: test-route
   spec:
       parentRefs:
       - name: external-gateway
       hostnames:
       - "test.com"
       rules:
       - matches:
           - path:
               type: Exact
               value: /testpath
           backendRefs:
           - name: my-app-service
             port: 80
   ```

   Where:

   * `external-gateway` — the name of the Gateway object;
   * `my-app-service` — the name of the service you are publishing to the Internet.

2. Apply the manifest:

   ```bash
   kubectl apply -f <file_name>
   ```

   Specify `<file_name>` — the name of the YAML file with the manifest to create the HTTPRoute object. For example, `<httproute.yaml>`.

<Formbricks />
