Skip to content

Commit edbbd8a

Browse files
authored
Update README.md
1 parent 7bb31d1 commit edbbd8a

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

README.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
# ingress-nginx-mtls-demo
22

3+
![](images/ingressnginxcontroller.png)
4+
5+
*image from [Nginx](https://www.nginx.com/blog/announcing-nginx-ingress-controller-for-kubernetes-release-1-6-0/)*
6+
37
## Step 1: Set up and start minikube
48

59
First things first, check to see if you have minikube installed and if the version is >= v1.19
610

711
``` minikube version ```
812

13+
![](images/version.png)
14+
915
If not installed follow the docs: https://minikube.sigs.k8s.io/docs/start/
1016

1117
once you confirm you have minikube installed, run the follow commands:
@@ -14,7 +20,13 @@ to start minikube: ``` minikube start ```
1420

1521
to enable the ingress addon: ``` minikube addons enable ingress ```
1622

17-
after enabling the ingress add on it will show you a message that says:
23+
if you want to confirm it is enabled run: ```minikube addons list | grep ingress ```
24+
25+
![](images/addons.png)
26+
27+
You will see the green checkmark beside enabled ✅
28+
29+
**after enabling the ingress add on it will show you a message that says:**
1830

1931
please run "minikube tunnel" and your ingress resources would be available at "127.0.0.1".
2032

@@ -33,15 +45,17 @@ If you have cloned this repo, then you will have all 3 of these yaml files in yo
3345
Let's also create a new namespace and switch into it before creating our resources:
3446

3547
create namespace: ``` kubectl create ns https-demo ```
36-
switch into new namespace: ``` kubectl config set-context --current --namespace=https-demo ```
37-
48+
switch into new namespace: ``` kubectl config set-context --current --namespace=https-demo ``
3849

39-
Then run ``` kubectl apply -f {eachyamlfile.yml} ```
50+
Then run ``` kubectl apply -f ingress.yml ```
51+
and two more time for the other 2 yml files.
4052

4153
This command will create each resource for you in your cluster.
4254

4355
At this point you can also start the ```minikube tunnel``` command in a seperate terminal so that your requests will be forwarded to localhost correctly.
4456

57+
![](images/tunnel.png)
58+
4559
## Step 3: Setting up your self signed CA and server certificate
4660

4761
We will be using our own self signed CA to sign both our server and client certificates using openSSL.
@@ -95,10 +109,11 @@ Let's see what will happen if we try to request our endpoint without passing a c
95109

96110
``` curl https://localhost/httpstest -k ```
97111

98-
note: we need to use the -k flag because we are using a self signed certificate for our server and CA meaning curl / browser doesn't trust it. This is fine for our demo purpose but in a real situation you'd never want to us a self signed CA or certificate.
112+
note: we need to use the -k flag because we are using a self signed certificate for our server and CA meaning curl / browser doesn't trust it. This is fine for our demo purpose but in a real situation you'd never want to use a self signed CA or certificate.
99113

100-
We can see that we are returned a 400 error code that says No required SSL certificate was sent!
114+
![](images/400.png)
101115

116+
We can see that we are returned a 400 error code that says No required SSL certificate was sent!
102117

103118
Perfect, let's fix that by creating a client certificate that is signed by the CA it is expecting.
104119

@@ -124,10 +139,11 @@ Now we can re try and see if we can access our resource!
124139

125140
We are passing in our client.crt and client.key with our request and receive a successful output from our application:
126141

142+
![](images/success.png)
127143

128144
We can see that our app is saying Hello, world! It also included the Hostname which is equivalent to the pod that we created with our deployment.
129145
You can confirm this by running a ``` kubectl get pods ``` command!
130146

131147
## Complete!
132148

133-
We have now set up our ingress nginx controller to enforce https / tls with the self signed CA and server cert we created using openssl, and have required the client to provide a certificate using the annotations in our ingress as well.
149+
We have now set up our ingress nginx controller to enforce https / tls with the self signed CA and server cert we created using openssl, and have required the client to provide a certificate using the annotations in our ingress as well.

0 commit comments

Comments
 (0)