-
Notifications
You must be signed in to change notification settings - Fork 0
/
secret.yaml
69 lines (66 loc) · 1.84 KB
/
secret.yaml
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
---
# service definition.
# this service will select any pod that has a label service=kubespark-service.
# the service targets port 4567 and exposes itself on port 30569.
apiVersion: v1
kind: Service
metadata:
name: secret
namespace: default
spec:
selector:
service: secret-service
ports:
- port: 4567
targetPort: 4567
nodePort: 30569
# there is no external load balancer, but this type will create a NodePort as well.
type: LoadBalancer
---
# deployment definition for the pods.
# Pods in this deployment get the label service=secret-service.
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: example-secret
# labels:
# serviceType: kubespark-app
spec:
replicas: 1
template:
metadata:
name: kubespark
labels:
# this label is used by the Service to select the pods
service: secret-service
spec:
containers:
- name: kubespark
image: kubespark:latest
imagePullPolicy: Never
ports:
- containerPort: 4567
# mount the volume called 'application-config' on the path '/config'.
volumeMounts:
- name: application-config
mountPath: "/config"
readOnly: true
# set an environment variable pointing to where the config data ended up.
env:
- name: CONFIGLOC
value: /config/encoded.json
# define a volume named 'application-config' and point it to the secret called secret-greet-config.
# any keys in the secret will become files in the volume.
volumes:
- name: application-config
secret:
secretName: secret-greet-config
---
apiVersion: v1
kind: Secret
metadata:
name: secret-greet-config
type: Opaque
data:
# note: keys in the secret become file names under the mount point
encoded.json: eyJncmVldGluZyI6Ik9vb28sIGEgdmVyeSBzZWNyZXQgZ3JlZXRpbmcuIn0=