Skip to content

Commit b9e7dfa

Browse files
committed
Add https example
1 parent e15cfa7 commit b9e7dfa

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed

examples/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
example.key
2+
example.crt

examples/https-nginx.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
kind: Service
3+
apiVersion: v1
4+
metadata:
5+
name: https-lb
6+
annotations:
7+
service.beta.kubernetes.io/linode-loadbalancer-throttle: "4"
8+
service.beta.kubernetes.io/linode-loadbalancer-default-protocol: "http"
9+
service.beta.kubernetes.io/linode-loadbalancer-port-443: |
10+
{
11+
"tls-secret-name": "example-secret",
12+
"protocol": "https"
13+
}
14+
spec:
15+
type: LoadBalancer
16+
selector:
17+
app: nginx-https-example
18+
ports:
19+
- name: http
20+
protocol: TCP
21+
port: 80
22+
targetPort: http
23+
- name: https
24+
protocol: TCP
25+
port: 443
26+
targetPort: https
27+
28+
---
29+
apiVersion: apps/v1
30+
kind: Deployment
31+
metadata:
32+
name: nginx-https-deployment
33+
spec:
34+
replicas: 2
35+
selector:
36+
matchLabels:
37+
app: nginx-https-example
38+
template:
39+
metadata:
40+
labels:
41+
app: nginx-https-example
42+
spec:
43+
containers:
44+
- name: nginx
45+
image: nginx
46+
ports:
47+
- name: http
48+
containerPort: 80
49+
protocol: TCP
50+
- name: https
51+
containerPort: 80
52+
protocol: TCP

examples/test.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
set -euxo pipefail
4+
5+
kubectl apply -f ./http-nginx.yaml
6+
kubectl apply -f ./tcp-nginx.yaml
7+
8+
openssl req -newkey rsa:4096 \
9+
-x509 \
10+
-sha256 \
11+
-days 3650 \
12+
-nodes \
13+
-out example.crt \
14+
-keyout example.key \
15+
-subj "/C=na/ST=na/L=na/O=na/OU=na/CN=na"
16+
17+
kubectl delete secret example-secret || true
18+
kubectl create secret tls example-secret --cert=example.crt --key=example.key
19+
kubectl apply -f ./https-nginx.yaml
20+

0 commit comments

Comments
 (0)