Skip to content

Commit e1f84a4

Browse files
committed
First Commit
0 parents  commit e1f84a4

25 files changed

+890
-0
lines changed

kube-manifests/.DS_Store

6 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: app1-nginx-deployment
5+
labels:
6+
app: app1-nginx
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
app: app1-nginx
12+
template:
13+
metadata:
14+
labels:
15+
app: app1-nginx
16+
spec:
17+
containers:
18+
- name: app1-nginx
19+
image: stacksimplify/kube-nginxapp1:1.0.0
20+
ports:
21+
- containerPort: 80
22+
# To schedule pods on based on NodeSelectors
23+
nodeSelector:
24+
app: system-apps
25+
26+
27+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: app1-nginx-clusterip-service
5+
labels:
6+
app: app1-nginx
7+
spec:
8+
type: LoadBalancer
9+
selector:
10+
app: app1-nginx
11+
ports:
12+
- port: 80
13+
targetPort: 80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
apiVersion: storage.k8s.io/v1
2+
kind: StorageClass
3+
metadata:
4+
name: managed-premium-retain-sc
5+
provisioner: kubernetes.io/azure-disk
6+
reclaimPolicy: Retain # Default is Delete, recommended is retain
7+
volumeBindingMode: WaitForFirstConsumer # Default is Immediate, recommended is WaitForFirstConsumer
8+
allowVolumeExpansion: true
9+
parameters:
10+
storageaccounttype: Premium_LRS # or we can use Standard_LRS
11+
kind: managed # Default is shared (Other two are managed and dedicated)
12+
13+
14+
##############################################################################
15+
# Note-1:
16+
#volumeBindingMode: Immediate - This setting implies that the PersistentVolumecreation,
17+
#followed with the storage medium (Azure Disk in this case) provisioning is triggered as
18+
#soon as the PersistentVolumeClaim is created.
19+
20+
# Note-2:
21+
# volumeBindingMode: WaitForFirstConsumer
22+
#By default, the Immediate mode indicates that volume binding and dynamic provisioning
23+
#occurs once the PersistentVolumeClaim is created. For storage backends that are
24+
#topology-constrained and not globally accessible from all Nodes in the cluster,
25+
#PersistentVolumes will be bound or provisioned without knowledge of the Pod's scheduling
26+
#requirements. This may result in unschedulable Pods.
27+
#A cluster administrator can address this issue by specifying the WaitForFirstConsumer
28+
#mode which will delay the binding and provisioning of a PersistentVolume until a
29+
#Pod using the PersistentVolumeClaim is created. PersistentVolumes will be selected or
30+
#provisioned conforming to the topology that is specified by the Pod's scheduling
31+
#constraints.
32+
##############################################################################
33+
# Note-3:
34+
#reclaimPolicy: Delete - With this setting, as soon as a PersistentVolumeClaim is deleted,
35+
#it also triggers the removal of the corresponding PersistentVolume along with the
36+
#Azure Disk.
37+
#We will be surprised provided if we intended to retain that data as backup.
38+
# reclaimPolicy: retain - Disk is retained even when PVC is deleted - Recommended Option
39+
40+
# Note-4:
41+
# Both reclaimPolicy: Delete and volumeBindingMode: Immediate are default settings
42+
##############################################################################
43+
# Note-5:
44+
# Additional Reference
45+
# https://kubernetes.io/docs/concepts/storage/storage-classes/#azure-disk
46+
# Managed: When managed used, that disk is persisted for the Lifecycle of the cluster.
47+
# If we delete cluster, it will delete the disk
48+
##############################################################################
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v1
2+
kind: PersistentVolumeClaim
3+
metadata:
4+
name: azure-managed-disk-pvc
5+
spec:
6+
accessModes:
7+
- ReadWriteOnce
8+
storageClassName: managed-premium-retain-sc
9+
resources:
10+
requests:
11+
storage: 5Gi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: usermanagement-dbcreation-script
5+
data:
6+
mysql_usermgmt.sql: |-
7+
DROP DATABASE IF EXISTS webappdb;
8+
CREATE DATABASE webappdb;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: mysql
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: mysql
10+
strategy:
11+
type: Recreate
12+
template:
13+
metadata:
14+
labels:
15+
app: mysql
16+
spec:
17+
containers:
18+
- name: mysql
19+
image: mysql:5.6
20+
env:
21+
- name: MYSQL_ROOT_PASSWORD
22+
value: dbpassword11
23+
ports:
24+
- containerPort: 3306
25+
name: mysql
26+
volumeMounts:
27+
- name: mysql-persistent-storage
28+
mountPath: /var/lib/mysql
29+
- name: usermanagement-dbcreation-script
30+
mountPath: /docker-entrypoint-initdb.d #https://hub.docker.com/_/mysql Refer Initializing a fresh instance
31+
volumes:
32+
- name: mysql-persistent-storage
33+
persistentVolumeClaim:
34+
claimName: azure-managed-disk-pvc
35+
- name: usermanagement-dbcreation-script
36+
configMap:
37+
name: usermanagement-dbcreation-script
38+
# To schedule pods on based on NodeSelectors
39+
nodeSelector:
40+
app: java-apps
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: mysql
5+
spec:
6+
selector:
7+
app: mysql
8+
ports:
9+
- port: 3306
10+
clusterIP: None # This means we are going to use Pod IP
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: usermgmt-webapp
5+
labels:
6+
app: usermgmt-webapp
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
app: usermgmt-webapp
12+
template:
13+
metadata:
14+
labels:
15+
app: usermgmt-webapp
16+
spec:
17+
initContainers:
18+
- name: init-db
19+
image: busybox:1.31
20+
command: ['sh', '-c', 'echo -e "Checking for the availability of MySQL Server deployment"; while ! nc -z mysql 3306; do sleep 1; printf "-"; done; echo -e " >> MySQL DB Server has started";']
21+
containers:
22+
- name: usermgmt-webapp
23+
image: stacksimplify/kube-usermgmt-webapp:1.0.0-MySQLDB
24+
imagePullPolicy: Always
25+
ports:
26+
- containerPort: 8080
27+
env:
28+
- name: DB_HOSTNAME
29+
value: "mysql"
30+
- name: DB_PORT
31+
value: "3306"
32+
- name: DB_NAME
33+
value: "webappdb"
34+
- name: DB_USERNAME
35+
value: "root"
36+
- name: DB_PASSWORD
37+
value: "dbpassword11"
38+
# To schedule pods on based on NodeSelectors
39+
nodeSelector:
40+
app: java-apps
41+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: usermgmt-webapp-service
5+
labels:
6+
app: usermgmt-webapp
7+
spec:
8+
type: LoadBalancer
9+
selector:
10+
app: usermgmt-webapp
11+
ports:
12+
- port: 80
13+
targetPort: 8080
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: windows-app1-deployment
5+
labels:
6+
app: windows-app1
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
app: windows-app1
12+
template:
13+
metadata:
14+
name: windows-app1
15+
labels:
16+
app: windows-app1
17+
spec:
18+
# To schedule pods on based on NodeSelectors
19+
nodeSelector:
20+
#"beta.kubernetes.io/os": windows
21+
app: dotnet-apps
22+
containers:
23+
- name: windows-app1
24+
image: mcr.microsoft.com/dotnet/framework/samples:aspnetapp
25+
resources:
26+
limits:
27+
cpu: 1
28+
memory: 800M
29+
requests:
30+
cpu: .1
31+
memory: 300M
32+
ports:
33+
- containerPort: 80
34+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: windows-app1-loadbalancer-service
5+
spec:
6+
type: LoadBalancer
7+
selector:
8+
app: windows-app1
9+
ports:
10+
- protocol: TCP
11+
port: 80

0 commit comments

Comments
 (0)