Many of the examples in this directory have common prerequisites.
TLS certificates
Unless otherwise mentioned, the TLS secret used in examples is a 2048 bit RSA key/cert pair with an arbitrarily chosen hostname, created as follows
$ openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout tls.key -out tls.crt -subj "/CN=nginxsvc/O=nginxsvc"
Generating a 2048 bit RSA private key
................+++
................+++
writing new private key to 'tls.key'
-----
$ kubectl create secret tls tls-secret --key tls.key --cert tls.crt
secret "tls-secret" created
Note: If using CA Authentication, described below, you will need to sign the server certificate with the CA.
Client Certificate Authentication
CA Authentication also known as Mutual Authentication allows both the server and client to verify each others identity via a common CA.
We have a CA Certificate which we obtain usually from a Certificate Authority and use that to sign both our server certificate and client certificate. Then every time we want to access our backend, we must pass the client certificate.
These instructions are based on the following blog
Once this is complete you can continue to follow the instructions here
Test HTTP Service
All examples that require a test HTTP Service use the standard http-svc pod, which you can deploy as follows
$ kubectl create -f http-svc.yaml
service "http-svc" created
replicationcontroller "http-svc" created
$ kubectl get po
NAME READY STATUS RESTARTS AGE
http-svc-p1t3t 1/1 Running 0 1d
$ kubectl get svc
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
http-svc 10.0.122.116 <pending> 80:30301/TCP 1d
You can test that the HTTP Service works by exposing it temporarily