This YAML file defines a Kubernetes Persistent Volume and a Persistent Volume Claim that can be used to provision and consume storage resources respectively in a Kubernetes cluster.
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-azure-file
labels:
pv-name: pv-azure-file
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteMany
storageClassName: azurefile
azureFile:
secretName: azure-secret
shareName: sql-fileshare
readOnly: false
mountOptions:
- dir_mode=0777
- file_mode=0777
- uid=10001
- gid=10001
persistentVolumeReclaimPolicy: Retain
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: my-pvc
namespace: rak
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Gi
storageClassName: azurefile
selector:
matchLabels:
pv-name: pv-azure-file
---
kubectl create secret generic mssql --from-literal=MSSQL_SA_PASSWORD="MyC0m9l&xP@ssw0rd" -n rak
----
apiVersion: apps/v1
kind: Deployment
metadata:
name: mssql-deployment
namespace: rak
spec:
replicas: 1
selector:
matchLabels:
app: mssql
template:
metadata:
labels:
app: mssql
spec:
terminationGracePeriodSeconds: 30
hostname: mssqlinst
securityContext:
fsGroup: 10001
containers:
- name: mssql
image: mcr.microsoft.com/mssql/server:2019-latest
resources:
requests:
memory: "2G"
cpu: "2000m"
limits:
memory: "2G"
cpu: "2000m"
ports:
- containerPort: 1433
env:
- name: MSSQL_PID
value: "Developer"
- name: ACCEPT_EULA
value: "Y"
- name: MSSQL_SA_PASSWORD
valueFrom:
secretKeyRef:
name: mssql
key: MSSQL_SA_PASSWORD
volumeMounts:
- name: mssqldb
mountPath: /var/opt/mssql
volumes:
- name: mssqldb
persistentVolumeClaim:
claimName: my-pvc
---
apiVersion: v1
kind: Service
metadata:
name: mssql-deployment
namespace: rak
spec:
selector:
app: mssql
ports:
- protocol: TCP
port: 1433
targetPort: 1433
type: LoadBalancer
No comments:
Post a Comment