Skip to content

Commit 53f8f67

Browse files
authored
Merge pull request #1 from stacksimplify/master
Updates
2 parents 9b6f3aa + fc607f9 commit 53f8f67

File tree

112 files changed

+4201
-164
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+4201
-164
lines changed

05-Azure-Disks-for-AKS-Storage/05-03-UserMgmt-WebApp-with-MySQLDB/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ Password: password101
8383
# Connect to MYSQL Database
8484
kubectl run -it --rm --image=mysql:5.6 --restart=Never mysql-client -- mysql -h mysql -pdbpassword11
8585
86-
# Verify usermgmt schema got created which we provided in ConfigMap
86+
# Verify webappdb schema got created which we provided in ConfigMap
8787
mysql> show schemas;
88-
mysql> use usermgmt;
88+
mysql> use webappdb;
8989
mysql> show tables;
9090
mysql> select * from user;
9191
```
@@ -108,4 +108,4 @@ kubectl delete pv <PV-NAME>
108108
109109
# Delete Azure Disks
110110
Go to All Services -> Disks -> Select and Delete the Disk
111-
```
111+
```

09-Ingress-Basic/README.md

+14-15
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
# Ingress - Basics
22

33
## Step-01: Introduction
4-
54
### Ingress Basic Architecture
6-
75
[![Image](https://www.stacksimplify.com/course-images/azure-aks-ingress-basic.png "Azure AKS Kubernetes - Masterclass")](https://www.udemy.com/course/aws-eks-kubernetes-masterclass-devops-microservices/?referralCode=257C9AD5B5AF8D12D1E1)
86

97
### What are we going to learn?
@@ -17,7 +15,7 @@
1715
- Clean-Up or delete application after testing
1816

1917
## Step-02: Create Static Public IP
20-
```
18+
```t
2119
# Get the resource group name of the AKS cluster
2220
az aks show --resource-group aks-rg1 --name aksdemo1 --query nodeResourceGroup -o tsv
2321

@@ -28,13 +26,13 @@ az network public-ip create --resource-group <REPLACE-OUTPUT-RG-FROM-PREVIOUS-CO
2826
az network public-ip create --resource-group MC_aks-rg1_aksdemo1_centralus --name myAKSPublicIPForIngress --sku Standard --allocation-method static --query publicIp.ipAddress -o tsv
2927
```
3028
- Make a note of Static IP which we will use in next step when installing Ingress Controller
31-
```
29+
```t
3230
# Make a note of Public IP created for Ingress
3331
52.154.156.139
3432
```
3533

3634
## Step-03: Install Ingress Controller
37-
```
35+
```t
3836
# Install Helm3 (if not installed)
3937
brew install helm
4038

@@ -43,7 +41,6 @@ kubectl create namespace ingress-basic
4341

4442
# Add the official stable repository
4543
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
46-
helm repo add stable https://kubernetes-charts.storage.googleapis.com/
4744
helm repo update
4845

4946
# Customizing the Chart Before Installing.
@@ -53,19 +50,19 @@ helm show values ingress-nginx/ingress-nginx
5350
helm install ingress-nginx ingress-nginx/ingress-nginx \
5451
--namespace ingress-basic \
5552
--set controller.replicaCount=2 \
56-
--set controller.nodeSelector."beta\.kubernetes\.io/os"=linux \
57-
--set defaultBackend.nodeSelector."beta\.kubernetes\.io/os"=linux \
53+
--set controller.nodeSelector."kubernetes\.io/os"=linux \
54+
--set defaultBackend.nodeSelector."kubernetes\.io/os"=linux \
5855
--set controller.service.externalTrafficPolicy=Local \
5956
--set controller.service.loadBalancerIP="REPLACE_STATIC_IP"
6057

61-
# Replace Static IP captured in Step-02
58+
# Replace Static IP captured in Step-02 (without beta for NodeSelectors)
6259
helm install ingress-nginx ingress-nginx/ingress-nginx \
6360
--namespace ingress-basic \
6461
--set controller.replicaCount=2 \
65-
--set controller.nodeSelector."beta\.kubernetes\.io/os"=linux \
66-
--set defaultBackend.nodeSelector."beta\.kubernetes\.io/os"=linux \
62+
--set controller.nodeSelector."kubernetes\.io/os"=linux \
63+
--set defaultBackend.nodeSelector."kubernetes\.io/os"=linux \
6764
--set controller.service.externalTrafficPolicy=Local \
68-
--set controller.service.loadBalancerIP="52.154.156.139"
65+
--set controller.service.loadBalancerIP="52.154.156.139"
6966

7067

7168
# List Services with labels
@@ -92,7 +89,7 @@ Primarily refer Settings -> Frontend IP Configuration
9289
- 03-Ingress-Basic.yml
9390

9491
## Step-05: Deploy Application k8s manifests and verify
95-
```
92+
```t
9693
# Deploy
9794
kubectl apply -f kube-manifests/
9895

@@ -115,7 +112,7 @@ kubectl logs -f <pod-name> -n ingress-basic
115112
```
116113

117114
## Step-06: Clean-Up Apps
118-
```
115+
```t
119116
# Delete Apps
120117
kubectl delete -f kube-manifests/
121118
```
@@ -130,9 +127,11 @@ kubectl delete -f kube-manifests/
130127
- https://kubernetes.github.io/ingress-nginx/deploy/#azure
131128
- https://helm.sh/docs/intro/install/
132129
- https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#ingress-v1-networking-k8s-io
130+
- [Kubernetes Ingress API Reference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#ingress-v1-networking-k8s-io)
131+
- [Ingress Path Types](https://kubernetes.io/docs/concepts/services-networking/ingress/#path-types)
133132

134133
## Important Note
135134
```
136135
Ingress Admission Webhooks
137136
With nginx-ingress-controller version 0.25+, the nginx ingress controller pod exposes an endpoint that will integrate with the validatingwebhookconfiguration Kubernetes feature to prevent bad ingress from being added to the cluster. This feature is enabled by default since 0.31.0.
138-
```
137+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
23+
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: ClusterIP
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,16 @@
1+
apiVersion: networking.k8s.io/v1beta1
2+
kind: Ingress
3+
metadata:
4+
name: nginxapp1-ingress-service
5+
annotations:
6+
kubernetes.io/ingress.class: nginx
7+
spec:
8+
rules:
9+
- http:
10+
paths:
11+
- path: /
12+
backend:
13+
serviceName: app1-nginx-clusterip-service
14+
servicePort: 80
15+
16+

09-Ingress-Basic/kube-manifests/03-Ingress-Basic.yml

+14-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
apiVersion: networking.k8s.io/v1beta1
1+
apiVersion: networking.k8s.io/v1
22
kind: Ingress
33
metadata:
44
name: nginxapp1-ingress-service
5-
spec:
5+
annotations:
6+
kubernetes.io/ingress.class: nginx
7+
spec:
68
rules:
7-
- http:
8-
paths:
9-
- path: /
10-
backend:
11-
serviceName: app1-nginx-clusterip-service
12-
servicePort: 80
9+
- http:
10+
paths:
11+
- path: /
12+
pathType: Prefix
13+
backend:
14+
service:
15+
name: app1-nginx-clusterip-service
16+
port:
17+
number: 80
18+
1319

14-

10-Ingress-Context-Path-Based-Routing/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
- 04-IngressService-Manifests
1515

1616
## Step-04: Deploy and Verify
17-
```
17+
```t
1818
# Deploy Apps
1919
kubectl apply -R -f kube-manifests/
2020

@@ -33,7 +33,7 @@ kubectl logs -f <pod-name> -n ingress-basic
3333
```
3434

3535
## Step-05: Access Applications
36-
```
36+
```t
3737
# Access App1
3838
http://<Public-IP-created-for-Ingress>/app1/index.html
3939

@@ -44,11 +44,10 @@ http://<Public-IP-created-for-Ingress>/app2/index.html
4444
http://<Public-IP-created-for-Ingress>
4545
Username: admin101
4646
Password: password101
47-
4847
```
4948

5049
## Step-06: Clean-Up Applications
51-
```
50+
```t
5251
# Delete Apps
5352
kubectl delete -f kube-manifests/
5453

@@ -58,4 +57,5 @@ Go to All Services -> Azure Disks -> Delete disk
5857

5958
## Ingress Annotation Reference
6059
- https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/
60+
- [Ingress Path Types](https://kubernetes.io/docs/concepts/services-networking/ingress/#path-types)
6161

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
23+
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: ClusterIP
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,21 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: app2-nginx-deployment
5+
labels:
6+
app: app2-nginx
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
app: app2-nginx
12+
template:
13+
metadata:
14+
labels:
15+
app: app2-nginx
16+
spec:
17+
containers:
18+
- name: app2-nginx
19+
image: stacksimplify/kube-nginxapp2:1.0.0
20+
ports:
21+
- containerPort: 80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: app2-nginx-clusterip-service
5+
labels:
6+
app: app2-nginx
7+
annotations:
8+
spec:
9+
type: ClusterIP
10+
selector:
11+
app: app2-nginx
12+
ports:
13+
- port: 80
14+
targetPort: 80
15+
16+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: v1
2+
kind: PersistentVolumeClaim
3+
metadata:
4+
name: azure-managed-disk-pvc
5+
spec:
6+
accessModes:
7+
- ReadWriteOnce
8+
storageClassName: managed-premium
9+
resources:
10+
requests:
11+
storage: 5Gi
12+
13+
# AKS already provisioned Storage classes managed-premium and default as part of
14+
# default cluster setup
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+
valueFrom:
23+
secretKeyRef:
24+
name: mysql-db-password
25+
key: db-password
26+
ports:
27+
- containerPort: 3306
28+
name: mysql
29+
volumeMounts:
30+
- name: mysql-persistent-storage
31+
mountPath: /var/lib/mysql
32+
- name: usermanagement-dbcreation-script
33+
mountPath: /docker-entrypoint-initdb.d #https://hub.docker.com/_/mysql Refer Initializing a fresh instance
34+
volumes:
35+
- name: mysql-persistent-storage
36+
persistentVolumeClaim:
37+
claimName: azure-managed-disk-pvc
38+
- name: usermanagement-dbcreation-script
39+
configMap:
40+
name: usermanagement-dbcreation-script

0 commit comments

Comments
 (0)