Skip to content

Commit

Permalink
Finishing code upload
Browse files Browse the repository at this point in the history
  • Loading branch information
JBalzano authored Oct 19, 2021
1 parent 31a00f6 commit 96661b6
Show file tree
Hide file tree
Showing 66 changed files with 1,022 additions and 0 deletions.
18 changes: 18 additions & 0 deletions CH06/Listing0601-Using a Volume in a Pod Spec (volume.yaml).txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Pod
metadata:
name: nginx-pod
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
volumeMounts:
- name: webcontent
mountPath: "/usr/share/nginx/html/web-app"
volumes:
- name: webcontent
nfs:
server: 172.16.94.5
path: "/srv/exports/volumes/webcontent"
12 changes: 12 additions & 0 deletions CH06/Listing0602-Example Persistent Volume (pv.yaml).txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-nfs-data-static
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteMany
nfs:
server: 172.16.94.5
path: "/srv/exports/volumes/webcontent"
10 changes: 10 additions & 0 deletions CH06/Listing0603-Example Persistent Volume Claim (pvc.yaml).txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc-nfs-data-static
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Gi
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-nfs-deployment
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
volumes:
- name: webcontent
persistentVolumeClaim:
claimName: pvc-nfs-data-static
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
volumeMounts:
- name: webcontent
mountPath: "/usr/share/nginx/html/web-app"
---
apiVersion: v1
kind: Service
metadata:
name: nginx-nfs-service
spec:
selector:
app: nginx
ports:
- port: 80
protocol: TCP
targetPort: 80
57 changes: 57 additions & 0 deletions CH06/Listing0605-nfs-rbac.yaml.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
kind: ServiceAccount
apiVersion: v1
metadata:
name: nfs-client-provisioner
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: nfs-client-provisioner-runner
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["events"]
verbs: ["create", "update", "patch"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: run-nfs-client-provisioner
subjects:
- kind: ServiceAccount
name: nfs-client-provisioner
namespace: default
roleRef:
kind: ClusterRole
name: nfs-client-provisioner-runner
apiGroup: rbac.authorization.k8s.io
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: leader-locking-nfs-client-provisioner
rules:
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: leader-locking-nfs-client-provisioner
subjects:
- kind: ServiceAccount
name: nfs-client-provisioner
namespace: default
roleRef:
kind: Role
name: leader-locking-nfs-client-provisioner
apiGroup: rbac.authorization.k8s.io
7 changes: 7 additions & 0 deletions CH06/Listing0606-nfs-storageclass.yaml.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: nfs-storage
provisioner: example.com/nfs
parameters:
archiveOnDelete: "false"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
spec:
containers:
- command:
- kube-apiserver
1 change: 1 addition & 0 deletions CH06/Listing0608-New line in kube-apiserver.yaml.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- --feature-gates=RemoveSelfLink=false
35 changes: 35 additions & 0 deletions CH06/Listing0609-nfs-provisioner.yaml.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
kind: Deployment
apiVersion: apps/v1
metadata:
name: nfs-client-provisioner
spec:
selector:
matchLabels:
app: nfs-client-provisioner
replicas: 1
strategy:
type: Recreate
template:
metadata:
labels:
app: nfs-client-provisioner
spec:
serviceAccountName: nfs-client-provisioner
containers:
- name: nfs-client-provisioner
image: quay.io/external_storage/nfs-client-provisioner:latest
volumeMounts:
- name: nfs-client-root
mountPath: /persistentvolumes
env:
- name: PROVISIONER_NAME
value: example.com/nfs
- name: NFS_SERVER
value: 172.16.94.5
- name: NFS_PATH
value: /srv/exports/volumes
volumes:
- name: nfs-client-root
nfs:
server: 172.16.94.5
path: /srv/exports/volumes
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc-nfs-data-dynamic
spec:
accessModes:
- ReadWriteOnce
storageClassName: nfs-storage
resources:
requests:
storage: 10Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-nfs-deployment-dynamic
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
volumeMounts:
- name: webcontent
mountPath: "/usr/share/nginx/html/web-app"
volumes:
- name: webcontent
persistentVolumeClaim:
claimName: pvc-nfs-data-dynamic
---
apiVersion: v1
kind: Service
metadata:
name: nginx-nfs-service-dynamic
spec:
selector:
app: nginx
ports:
- port: 80
protocol: TCP
targetPort: 80
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc-azure-data-dynamic
spec:
accessModes:
- ReadWriteOnce
storageClassName: managed-premium
resources:
requests:
storage: 10Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-azure-deployment-dynamic
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
volumeMounts:
- name: webcontent
mountPath: "/usr/share/nginx/html/web-app"
volumes:
- name: webcontent
persistentVolumeClaim:
claimName: pvc-azure-data-dynamic
---
apiVersion: v1
kind: Service
metadata:
name: nginx-azure-service-dynamic
spec:
selector:
app: nginx
ports:
- port: 80
protocol: TCP
targetPort: 80
type: LoadBalancer
29 changes: 29 additions & 0 deletions CH07/Listing0701-sql-storage.yaml.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-nfs-sql-instance-1
labels:
disk: system
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
nfs:
server: storage
path: "/srv/exports/volumes/sql-instance-1"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc-nfs-sql-instance-1
spec:
selector:
matchLabels:
disk: system
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kubectl apply -f sql-storage.yaml
2 changes: 2 additions & 0 deletions CH07/Listing0703-Verify previously created PV and PVC.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
kubectl get pv
kubectl get pvc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kubectl create secret generic mssql --from-literal=SA_PASSWORD=S0methingS@Str0ng!
51 changes: 51 additions & 0 deletions CH07/Listing0705-sql-deployment.yaml.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mssql-deployment
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: mssql
template:
metadata:
labels:
app: mssql
spec:
securityContext:
fsGroup: 10001
containers:
- name: mssql
image: 'mcr.microsoft.com/mssql/server:2019-CU8-ubuntu-18.04'
ports:
- containerPort: 1433
env:
- name: ACCEPT_EULA
value: "Y"
- name: SA_PASSWORD
valueFrom:
secretKeyRef:
name: mssql
key: SA_PASSWORD
volumeMounts:
- name: mssqldb
mountPath: /var/opt/mssql
volumes:
- name: mssqldb
persistentVolumeClaim:
claimName: pvc-nfs-sql-instance-1
---
apiVersion: v1
kind: Service
metadata:
name: mssql-deployment
spec:
selector:
app: mssql
ports:
- protocol: TCP
port: 31433
targetPort: 1433
type: NodePort
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kubectl apply -f sql-deployment.yaml
Loading

0 comments on commit 96661b6

Please sign in to comment.