forked from tomkukral/kubernetes-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkubeconfig-exposer.yml
92 lines (91 loc) · 1.68 KB
/
kubeconfig-exposer.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
# htaccess file with demo credentials
apiVersion: v1
kind: Secret
metadata:
name: htaccess
namespace: kube-system
data:
ht: Z2xhc3M6JGFwcjEkanZMTUhtREQkSmJUMzU0NEdpWHVXU2UwSVRCbXRBMQoK
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: basicauth
namespace: kube-system
spec:
basicAuth:
secret: htaccess
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: stripprefix
namespace: kube-system
spec:
stripPrefix:
prefixes:
- /kubeconfig
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: kubeconfig-exposer
namespace: kube-system
spec:
entryPoints:
- http
- https
#tls: {}
routes:
- match: PathPrefix(`/kubeconfig/`)
kind: Rule
middlewares:
- name: basicauth
- name: stripprefix
services:
- name: kubeconfig-exposer
port: 80
---
apiVersion: v1
kind: Service
metadata:
name: kubeconfig-exposer
namespace: kube-system
spec:
selector:
app: kubeconfig-exposer
ports:
- protocol: TCP
port: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: kubeconfig-exposer
namespace: kube-system
spec:
replicas: 1
selector:
matchLabels:
app: kubeconfig-exposer
template:
metadata:
labels:
app: kubeconfig-exposer
spec:
nodeSelector:
kubernetes.io/hostname: k8s-m1.fareoncloud.local
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
volumeMounts:
- name: config
mountPath: /usr/share/nginx/html/
volumes:
- name: config
hostPath:
path: /etc/kubernetes/users/
type: Directory