Skip to content

Commit

Permalink
Merge pull request #11 from Memal7/develop
Browse files Browse the repository at this point in the history
merge develop into main
  • Loading branch information
Memal7 authored Aug 29, 2023
2 parents f6c1aeb + 312e6b1 commit 81b1f01
Show file tree
Hide file tree
Showing 9 changed files with 146 additions and 0 deletions.
24 changes: 24 additions & 0 deletions 01_workloads/deployment-strategy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3
strategy:
rollingUpdate:
maxSurge: 4
maxUnavailable: 2
type: RollingUpdate
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
File renamed without changes.
16 changes: 16 additions & 0 deletions 03_configs-secrets/inject-configmap-pod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Pod
metadata:
name: webapp-color
labels:
app: webapp-color
spec:
containers:
- name: webapp-color
image: webapp-image
ports:
- containerPort: 80
envFrom:
- configMapRef:
name: app-config
name: app-config
7 changes: 7 additions & 0 deletions 03_configs-secrets/simple-configmaps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: app-config
data:
APP_CONFIG: blue
APP_ENV: prod
19 changes: 19 additions & 0 deletions 03_configs-secrets/simple-secret.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Pod
metadata:
name: nginx-secret
spec:
containers:
- name: nginx
image: nginx:1.14.2
env:
- name: NGINX_SECRET_VARIABLE
valueFrom:
secretKeyRef:
name: key3
key: key3-secret
resources:
limits:
cpu: "1"
memory: "512Mi"

10 changes: 10 additions & 0 deletions 04_volume-persistence/disk-storage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: managed-premium-retain
provisioner: disk.csi.azure.com
parameters:
skuName: Premium_ZRS
reclaimPolicy: Retain
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true
15 changes: 15 additions & 0 deletions 04_volume-persistence/pod-mounting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
kind: Pod
apiVersion: v1
metadata:
name: nginx
spec:
containers:
- name: myfrontend
image: mcr.microsoft.com/oss/nginx/nginx:1.15.5-alpine
volumeMounts:
- mountPath: "/mnt/azure"
name: volume
volumes:
- name: volume
persistentVolumeClaim:
claimName: azure-managed-disk
11 changes: 11 additions & 0 deletions 04_volume-persistence/pvc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: azure-managed-disk
spec:
accessModes:
- ReadWriteOnce
storageClassName: managed-premium-retain
resources:
requests:
storage: 5Gi
44 changes: 44 additions & 0 deletions kubectl-cheatsheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,48 @@ kubectl scale deployment <deployment-name> | -f file.deployment.yml --replicas=5
Get information about deployment:
```
kubectl describe deployment simple-nginx
```

---
## Create, delete, and manage ConfigMaps
Create a ConfigMap and input value directly through command:
```
kubectl create configmap app-config --from-literal=APP_COLOR=blue
```

Another way to input configurations through a file:
```
kubectl create configmap app-config --from-file=app_config.properties
```

List all ConfigMaps:
```
kubectl get configmaps
```

Describe a ConfigMap:
```
kubectl describe configmaps app-config
```

Apply a ConfigMap YAML file:
```
kubectl apply -f config-map.yml
```

---
## Create, delete, and manage Secrets
List all secrets:
```
kubectl get secrets
```

Create a new secret:
```
kubectl create secret generic db-secret --from-literal=DB_Host=sql01 --from-literal=DB_User=root --from-literal=DB_Password=password123
```

Delete a secret:
```
kubectl delete secret generic db-secret
```

0 comments on commit 81b1f01

Please sign in to comment.