forked from adntobias/Development-Praxisworkshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.yml
139 lines (131 loc) · 3.16 KB
/
deploy.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Deployment Frontend
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
spec:
replicas: 1
selector:
matchLabels:
app: frontend
template:
metadata:
labels:
app: frontend
spec:
nodeSelector:
"beta.kubernetes.io/os": linux
containers:
- name: frontend
image: <YOUR_ACR_NAME>.azurecr.io/frontend:v1 # private
imagePullPolicy: Always
resources:
requests:
cpu: 150m
memory: 256Mi
limits:
cpu: 250m
memory: 512Mi
ports:
- name: https
containerPort: 443
volumeMounts:
- name: claimvolumessd
mountPath: "/mnt/volumeMountSsd"
volumes:
- name: claimvolumessd
persistentVolumeClaim:
claimName: frontend-pvc
---
# Loadbalancer
apiVersion: v1
kind: Service
metadata:
name: frontend
annotations:
service.beta.kubernetes.io/azure-dns-label-name: frontend # sets dns name label to http://frontend.<region>.cloudapp.azure.com/
labels:
app: frontend
spec:
type: LoadBalancer
ports:
- port: 443 # Must be https for oAuth redirect
protocol: TCP
targetPort: https
selector:
app: frontend
#---
# Deployment test MultiContainerPod
#apiVersion: v1
#kind: Pod
#metadata:
# name: multi-pod
#spec:
# restartPolicy: Never
# containers:
# - name: frontendpod
# image: <YOUR_ACR_NAME>.azurecr.io/frontend:v1
# - name: backendpod
# image: akaino/backend:v3
---
# Create a StorageClass object pointing to the existing Storage Account
# Remember: that the Storage account must be in the same Resource Group where the AKS cluster is deployed
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: azurefile
provisioner: kubernetes.io/azure-file
mountOptions:
- dir_mode=0777
- file_mode=0777
parameters:
storageAccount: <YOUR_STORAGE_ACCOUNT_NAME>
location: germanywestcentral
---
# Create a Secret to hold the name and key of the Storage Account
# Remember: values are base64 encoded
apiVersion: v1
kind: Secret
metadata:
name: azurefile-secret
type: Opaque
data:
azurestorageaccountname: <YOUR_STORAGE_ACCOUNT_NAME_BASE64Encoded>
azurestorageaccountkey: <KEY_1_BASE64Encoded>
---
# Create a persistent volume, with the corresponding StorageClass and the reference to the Azure File secret.
# Remember: Create the share in the storage account otherwise the pods will fail with a "No such file or directory"
apiVersion: v1
kind: PersistentVolume
metadata:
name: frontend-pvc
spec:
capacity:
storage: 2Gi
accessModes:
- ReadWriteOnce
storageClassName: azurefile
azureFile:
secretName: azurefile-secret
shareName: aksshare
readOnly: false
mountOptions:
- dir_mode=0777
- file_mode=0777
- uid=1000
- gid=1000
---
# Create a PersistentVolumeClaim referencing the StorageClass and the volume
# Remember: this is a static scenario. The volume was created in the previous step.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: frontend-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
storageClassName: azurefile
volumeName: frontend-pvc