-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
66 changed files
with
1,022 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
CH06/Listing0601-Using a Volume in a Pod Spec (volume.yaml).txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
10
CH06/Listing0603-Example Persistent Volume Claim (pvc.yaml).txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
38 changes: 38 additions & 0 deletions
38
CH06/Listing0604-A Deployment using Persistent Storage (deployment-static.yaml).txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
4 changes: 4 additions & 0 deletions
4
CH06/Listing0607-API Server section in kube-apiserver.yaml.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
spec: | ||
containers: | ||
- command: | ||
- kube-apiserver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- --feature-gates=RemoveSelfLink=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
50 changes: 50 additions & 0 deletions
50
CH06/Listing0610-A Deployment using dynamic provisioning (deployment-dynamic.yaml).txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
51 changes: 51 additions & 0 deletions
51
...olume Claim and dynamic provisioning of Azure storage (deployment-dynamic-azure.yaml).txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
1 change: 1 addition & 0 deletions
1
CH07/Listing0702-Apply sql-storage.yaml to Kubernetes cluster.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
kubectl apply -f sql-storage.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
kubectl get pv | ||
kubectl get pvc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
kubectl create secret generic mssql --from-literal=SA_PASSWORD=S0methingS@Str0ng! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
1 change: 1 addition & 0 deletions
1
CH07/Listing0706-Apply sql-deployment.yaml to Kubernetes cluster.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
kubectl apply -f sql-deployment.yaml |
Oops, something went wrong.