Skip to content

Commit a2c37bf

Browse files
committed
Replace bash code type with shell
1 parent 0bf68b3 commit a2c37bf

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

site/content/installation/installing-nic/deploy-with-nap-using-helm.md

+19-18
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,13 @@ Store these files locally:
3535
└── nginx-repo.jwt
3636
```
3737

38+
3839
## Step 2: Pull the NGINX App Protect WAF Compiler image
3940

4041
Log into the nginx private registry using your jwt file and the password `none` which you will have to type in when
4142
asked:
4243

43-
```bash
44+
```shell
4445
$ docker login private-registry.nginx.com --username=$(cat nginx-repo.jwt)
4546

4647
i Info → A Personal Access Token (PAT) can be used instead.
@@ -53,7 +54,7 @@ Login Succeeded
5354

5455
Once that's done, pull the `waf-compiler` image with:
5556

56-
```bash
57+
```shell
5758
$ docker pull private-registry.nginx.com/nap/waf-compiler:5.6.0
5859
```
5960

@@ -63,13 +64,13 @@ $ docker pull private-registry.nginx.com/nap/waf-compiler:5.6.0
6364

6465
Download the [provided WAF Policy JSON](https://raw.githubusercontent.com/nginx/kubernetes-ingress/main/tests/data/ap-waf-v5/wafv5.json):
6566

66-
```bash
67+
```shell
6768
curl -LO https://raw.githubusercontent.com/nginx/kubernetes-ingress/main/tests/data/ap-waf-v5/wafv5.json
6869
```
6970

7071
Use your pulled NAP Docker image (`private-registry.nginx.com/nap/waf-compiler:5.6.0`) to compile the policy bundle:
7172

72-
```bash
73+
```shell
7374
# Using your newly created image
7475
docker run --rm \
7576
-v $(pwd):$(pwd) \
@@ -127,13 +128,13 @@ spec:
127128
This sets up a 1Gi disk and attaches a claim to it that you will reference in the NIC deployment chart.
128129
129130
Create these with:
130-
```bash
131+
```shell
131132
kubectl apply -f pvc.yaml
132133
```
133134

134135
Verify that the persistent volume and claim are created:
135136

136-
```bash
137+
```shell
137138
# For the persistent volume
138139
kubectl get pv
139140

@@ -144,13 +145,13 @@ kubectl get pvc
144145
## Step 5: Deploy NGINX Plus NIC Controller with NAP Enabled using Helm
145146

146147
Add the official NGINX Helm repository:
147-
```bash
148+
```shell
148149
helm repo add nginx-stable https://helm.nginx.com/stable
149150
helm repo update
150151
```
151152

152153
Create Kubernetes Docker and licensing secrets:
153-
```bash
154+
```shell
154155
kubectl create secret \
155156
docker-registry regcred \
156157
--docker-server=private-registry.nginx.com \
@@ -165,13 +166,13 @@ kubectl create secret \
165166

166167
Install the required CRDs for NGINX Ingress Controller:
167168

168-
```bash
169+
```shell
169170
kubectl apply -f https://raw.githubusercontent.com/nginx/kubernetes-ingress/v5.0.0/deploy/crds.yaml
170171
```
171172

172173
Using helm, install NGINX Ingress Controller
173174

174-
```bash
175+
```shell
175176
helm upgrade nic nginx-stable/nginx-ingress \
176177
--set controller.image.repository="private-registry.nginx.com/nginx-ic-nap-v5/nginx-plus-ingress" \
177178
--set controller.image.tag="5.0.0-alpine-fips" \
@@ -186,7 +187,7 @@ helm upgrade nic nginx-stable/nginx-ingress \
186187
```
187188

188189
Verify deployment success:
189-
```bash
190+
```shell
190191
kubectl get pods
191192
```
192193

@@ -198,23 +199,23 @@ Get the name of the pod from the `kubectl get pods` command above.
198199

199200
Copy the file into the `nginx-ingress` container within the pod:
200201

201-
```bash
202+
```shell
202203
kubectl cp ./compiled_policy.tgz \
203204
<pod name>:/etc/app_protect/bundles/compiled_policy.tgz \
204205
-c nginx-ingress
205206
```
206207

207208
Replace `<pod name>` with the actual name of the pod, for example:
208209

209-
```bash
210+
```shell
210211
kubectl cp ./compiled_policy.tgz \
211212
nic-nginx-ingress-controller-9bd89589d-j925h:/etc/app_protect/bundles/compiled_policy.tgz \
212213
-c nginx-ingress
213214
```
214215

215216
Confirm that the policy file is in the pod. The following command should list `compiled_policy.tgz`.
216217

217-
```bash
218+
```shell
218219
kubectl exec --stdin --tty \
219220
-c nginx-ingress \
220221
<pod name> \
@@ -290,13 +291,13 @@ spec:
290291
291292
Find out what they are with this:
292293
293-
```bash
294+
```shell
294295
kubectl get svc
295296
```
296297
Take note of the external IP of the `nic-nginx-ingress-controller` service and the port. Save them in the following
297298
environment variables:
298299

299-
```bash
300+
```shell
300301
IC_IP=XXX.YYY.ZZZ.III
301302
IC_HTTP_PORT=<port number>
302303
```
@@ -305,7 +306,7 @@ IC_HTTP_PORT=<port number>
305306

306307
Send a valid request to the deployed application:
307308

308-
```bash
309+
```shell
309310
curl --resolve webapp.example.com:$IC_HTTP_PORT:$IC_IP http://webapp.example.com:$IC_HTTP_PORT/
310311
```
311312

@@ -319,7 +320,7 @@ Request ID: 4f378a01fb8a36ae27e2c3059d264527
319320

320321
And send one that should be rejected
321322

322-
```bash
323+
```shell
323324
curl --resolve webapp.example.com:$IC_HTTP_PORT:$IC_IP "http://webapp.example.com:$IC_HTTP_PORT/<script>"
324325
```
325326

0 commit comments

Comments
 (0)