Skip to content

Commit 2fe939e

Browse files
NGINX Ingresswith Linkerd guide (#3993)
1 parent 1c17683 commit 2fe939e

File tree

1 file changed

+155
-0
lines changed

1 file changed

+155
-0
lines changed
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
---
2+
title: NGINX Ingress Controller and Linkerd
3+
description: |
4+
Using Linkerd with the F5 NGINX Ingress Controller.
5+
weight: 1800
6+
doctypes: ["concept"]
7+
toc: true
8+
---
9+
10+
## Overview
11+
12+
This document explains how to integrate NGINX Ingress Controller with Linkerd using Linkerd's sidecar proxy. Linkerd works with both NGINX Ingress Controller open source and NGINX Ingress Controller using NGINX Plus.
13+
14+
---
15+
16+
## Before you Begin
17+
18+
There are two methods provided in this tutorial:
19+
20+
* Adding Linkerd to a new NGINX Ingress Controller Installation
21+
* Adding Linkerd to an Existing NGINX Ingress Controller Installation
22+
23+
If you are adding Linkerd to an existing installation, these are the requirements:
24+
25+
* A working NGINX Ingress Controller instance.
26+
* A working [Linkerd installation](https://linkerd.io/2.13/getting-started/).
27+
28+
---
29+
30+
## Integrating Linkerd
31+
32+
Linkerd integrates with NGINX Ingress Controller using its control plane utility through injection.
33+
34+
You can do this through the use of NGINX Ingress Controller's custom resource definitions (CRDs) in a Kubernetes Manifest, or Helm.
35+
36+
---
37+
38+
### During Installation
39+
**Using Manifests**
40+
41+
When installing NGINX Ingress Controller, you can [create a custom resource](https://docs.nginx.com/nginx-ingress-controller/installation/installation-with-manifests/#3-create-custom-resources) for Linkerd.
42+
43+
```yaml
44+
apiVersion: apps/v1
45+
kind: Deployment
46+
metadata:
47+
name: nginx-ingress
48+
namespace: nginx-ingress
49+
spec:
50+
replicas: 1
51+
selector:
52+
matchLabels:
53+
app: nginx-ingress
54+
template:
55+
metadata:
56+
annotations:
57+
linkerd.io/inject: enabled
58+
labels:
59+
app: nginx-ingress
60+
app.kubernetes.io/name: nginx-ingress
61+
```
62+
63+
**Using Helm**
64+
65+
Add the following annotation to your Helm deployment:
66+
67+
```yaml
68+
controller:
69+
pod:
70+
## The annotations of the Ingress Controller pod.
71+
annotations: { linkerd.io/inject: enabled }
72+
```
73+
74+
This annotation will instruct `helm` to tell `Linkerd` to automatically inject its sidecar during the installation of NGINX Ingress Controller.
75+
76+
---
77+
78+
### With an Existing Installation
79+
To integrate Linkerd with an existing NGINX Ingress Controller installation, you will need to inject the `Linkerd` sidecar, using its `linkerd` control plane utility.
80+
81+
**Using Manifests**
82+
83+
If you want to inject into an existing Manifest-based installation, you can run the following:
84+
85+
```bash
86+
kubectl get deployment -n nginx-ingress nginx-ingress -o yaml | linkerd inject - | kubectl apply -f -
87+
```
88+
89+
**Using Helm**
90+
If you want to inject into an existing `Helm` installation, you can run the following:
91+
92+
```bash
93+
kubectl get deployment -n <name_of_namespace> <name_of_helm_release> -o yaml | linkerd inject - | kubectl apply -f -
94+
```
95+
In this example, the `helm` release named `kic01-nginx-ingress-controller` is injected into the `nginx-ingress` namespace:
96+
97+
```bash
98+
kubectl get deploy -n nginx-ingress kic01-nginx-ingress-controller -o yaml | linkerd inject - | kubectl apply -f -
99+
```
100+
101+
## Testing the Integration
102+
103+
Once NGINX Ingress Controller has been integrated with Linkerd, we can check the number of pods to confirm that the sidecar has successfully injected.
104+
105+
```bash
106+
kubectl get pods -n nginx-ingress
107+
108+
NAME READY STATUS RESTARTS AGE
109+
kic01-nginx-ingress-controller-5f8c9b586d-ng4r8 2/2 Running 0 30m
110+
```
111+
112+
In the above example, `2/2` displays the number of pods, and confirms the `Linkerd` sidecar has successfully injected into NGINX Ingress Controller.
113+
114+
For additional testing, we can install an example application. In this case, we'll use the `httpbin` image.
115+
116+
```bash
117+
kubectl create ns httpbin
118+
curl -sL https://raw.githubusercontent.com/openservicemesh/osm-docs/release-v1.2/manifests/samples/httpbin/httpbin.yaml
119+
kubectl apply -f httpbin.yaml
120+
```
121+
122+
Once `httpbin` has been created and applied, we can inject it into an existing deployment with the following command:
123+
124+
```bash
125+
kubectl get deployment -n httpbin httpbin -o yaml | linkerd inject - | kubectl apply -f -
126+
```
127+
128+
Like the main installation, you can check the number of pods to confirm that the application has been successfully injected using the `linkerd` sidecar:
129+
130+
```bash
131+
kubectl get pods -n httpbin
132+
NAME READY STATUS RESTARTS AGE
133+
httpbin-66df5bfbc9-ffhdp 2/2 Running 0 67s
134+
```
135+
136+
We can now start sending traffic to NGINX Ingress Controller, to verify that `Linkerd` is handling the sidecar traffic connections.
137+
138+
```bash
139+
curl -k https://httpbin.example.com -I
140+
141+
HTTP/1.1 200 OK
142+
Server: nginx/1.23.4
143+
Date: Sat, 20 May 2023 00:08:31 GMT
144+
Content-Type: text/html; charset=utf-8
145+
Content-Length: 9593
146+
Connection: keep-alive
147+
access-control-allow-credentials: true
148+
access-control-allow-origin: *
149+
```
150+
151+
You can additionally view the status of NGINX Ingress Controller and Linkerd by using the Viz dashboard provided by Linkerd.
152+
153+
```bash
154+
linkerd viz dashboard
155+
```

0 commit comments

Comments
 (0)