You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aspnetcore/fundamentals/servers/yarp/kubernetes-ingress.md
+32-33Lines changed: 32 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,6 @@ ms.topic: article
9
9
content_well_notification: AI-contribution
10
10
ai-usage: ai-assisted
11
11
---
12
-
13
12
# YARP Kubernetes Ingress Controller
14
13
15
14
Introduced: Future Preview
@@ -20,33 +19,36 @@ YARP can be integrated with Kubernetes as a reverse proxy managing HTTP/HTTPS tr
20
19
21
20
Before we continue with this tutorial, make sure you have the following ready...
22
21
23
-
1. Installing [docker](https://docs.docker.com/install/) based on your operating system.
22
+
1. Installing [Docker](https://docs.docker.com/install/) based on your operating system.
23
+
24
+
1. A container registry. Docker by default will create a container registry on [DockerHub](https://hub.docker.com/). You could also use [Azure Container Registry](/en-us/azure/aks/tutorial-kubernetes-prepare-acr) or another container registry of your choice, like a [local registry](https://docs.docker.com/registry/deploying/#run-a-local-registry) for testing.
24
25
25
-
2. A container registry. Docker by default will create a container registry on [DockerHub](https://hub.docker.com/). You could also use [Azure Container Registry](/en-us/azure/aks/tutorial-kubernetes-prepare-acr) or another container registry of your choice, like a [local registry](https://docs.docker.com/registry/deploying/#run-a-local-registry) for testing.
26
+
1. A Kubernetes Cluster. There are many different options here, including:
26
27
27
-
3. A Kubernetes Cluster. There are many different options here, including:
-[Kubernetes in Docker Desktop](https://www.docker.com/blog/docker-windows-desktop-now-kubernetes/), however it does take up quite a bit of memory on your machine, so use with caution.
*[Kubernetes in Docker Desktop](https://www.docker.com/blog/docker-windows-desktop-now-kubernetes/), however it does take up quite a bit of memory on your machine, so use with caution.
*[K3s](https://k3s.io), a lightweight single-binary certified Kubernetes distribution from Rancher.
32
+
* Another Kubernetes provider of your choice.
33
33
34
-
> :warning: If you choose a container registry provided by a cloud provider (other than Dockerhub), you will likely have to take some steps to configure your kubernetes cluster to allow access. Follow the instructions provided by your cloud provider.
34
+
> [!NOTE]
35
+
> If you choose a container registry provided by a cloud provider other than Dockerhub, you probably must take steps to configure your Kubernetes cluster to allow access. Follow the instructions provided by your cloud provider.
35
36
36
-
## Get Started
37
+
## Get started
37
38
38
-
> :warning: For now there is no official docker image for the YARP ingress controller.
39
+
> [!NOTE]
40
+
> For now, there is no official Docker image for the YARP ingress controller.
39
41
40
-
So, in the meantime we need to build the YARP ingress controller locally and deploy it. In the root of the repository, run:
42
+
In the meantime, the YARP ingress controller must be built locally and deploy it. In the root of the repository, run:
where `REGISTRY_NAME`is the name of your docker registry and `TAG`is a tag for the image (for example1.0.0).
49
+
In the preceding commands, the `{REGISTRY_NAME}` placeholder is the name of the Docker registry, and the `{TAG}` placeholder is a tag for the image (for example, `1.0.0`).
48
50
49
-
Then the first step will be to deploy the YARP ingress controller to the Kubernetes cluster. This can be done by navigating to [Kubernetes Ingress sample](https://github.com/dotnet/yarp/tree/release/latest/samples/KubernetesIngress.Sample)`\samples\KubernetesIngress.Sample\Ingress`
51
+
The first step is to deploy the YARP ingress controller to the Kubernetes cluster. This can be done by navigating to [Kubernetes Ingress sample](https://github.com/dotnet/yarp/tree/release/latest/samples/KubernetesIngress.Sample)`\samples\KubernetesIngress.Sample\Ingress`
50
52
and running (after modifying `ingress-controller.yaml` with the same `REGISTRY_NAME` and `TAG`):
51
53
52
54
```
@@ -62,21 +64,21 @@ kubectl get pods -n yarp
62
64
You can then check logs from the ingress controller by running:
63
65
64
66
```
65
-
kubectl logs <POD NAME> -n yarp
67
+
kubectl logs {POD NAME} -n yarp
66
68
```
67
69
68
-
> :bulb:All services, deployments, and pods for YARP are in the namespace `yarp`. Make sure to include `-n yarp` if you want to check on the status of yarp.
70
+
All services, deployments, and pods for YARP are in the namespace `yarp`. Make sure to include `-n yarp` if you want to check on the status of yarp.
69
71
70
-
Next, we need to build and deploy our ingress. In the root of the repository, run:
72
+
Next, build and deploy the ingress. In the root of the repository, run:
where `REGISTRY_NAME`is the name of your docker registry and `TAG`is a tag for the image (for example1.0.0).
79
+
In the preceding commands, the `{REGISTRY_NAME}` placeholder is the name of the Docker registry, and the `{TAG}` placeholder is a tag for the image (for example, `1.0.0`).
78
80
79
-
Finally, we need to deploy the ingress itself to Kubernetes. To do this navigate again to the `Ingress` directory, modify the `ingress.yaml` file for your registry and tag specified earlier and run:
81
+
Finally, we need to deploy the ingress itself to Kubernetes. Navigate to the `Ingress` directory and modify the `ingress.yaml` file for your registry and tag specified earlier and run:
80
82
81
83
```
82
84
kubectl apply -f .\ingress.yaml
@@ -89,11 +91,11 @@ At this point, your ingress and controller should be running.
89
91
To use the ingress, we now need to deploy an application to Kubernetes. Navigate to `samples\KuberenetesIngress.Sample\backend` and run:
90
92
91
93
```
92
-
docker build . -t <REGISTRY_NAME>/backend:<TAG>
93
-
docker push <REGISTRY_NAME>/backend:<TAG>
94
+
docker build . -t {REGISTRY_NAME}/backend:{TAG}
95
+
docker push {REGISTRY_NAME}/backend:{TAG}
94
96
```
95
97
96
-
And deploying it to kubernetes by running (after modifying `backend.yaml` with the same `REGISTRY_NAME` and `TAG`):
98
+
And deploying it to Kubernetes by running, after modifying `backend.yaml` with the same registry name (`{REGISTRY_NAME}`) and tag (`{TAG}`):
97
99
98
100
```
99
101
kubectl apply -f .\backend.yaml
@@ -107,15 +109,12 @@ Finally, once we have deployed the backend application, we need to route traffic
107
109
kubectl apply -f .\ingress-sample.yaml
108
110
```
109
111
110
-
And then run:
112
+
And then execute the following command to get the external IP of the ingress, the name of the related service being `yarp-proxy`:
111
113
112
114
```
113
-
kubectl get service -n yarp
115
+
kubectl get service -n yarp
114
116
```
115
117
116
-
to get the external IP of the ingress, the name of the related service being `yarp-proxy`.
117
-
118
-
> :bulb: If you are using a local K8s cluster and don't get an external IP, you may need to not use the default `port: 80` for the `yarp-proxy` service.
119
-
If so, try to update again the `ingress.yaml` file to use another port e.g. `port: 8085` and then re-deploy the ingress to Kubernetes.
118
+
If you're using a local K8s cluster and don't get an external IP, you may be able to avoid using the default `port: 80` for the `yarp-proxy` service. If so, try to update the `ingress.yaml` file again to use another port (for example, `port: 8085`) and redeploy the ingress to Kubernetes.
120
119
121
120
Navigate to the external IP, and you should see the backend information.
0 commit comments