pvc sql-server-data

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: sql-server-data
  namespace: sre
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: "1000Gi"
  volumeName: 
  storageClassName: nfs

Deployment sql-server

apiVersion: apps/v1
kind: Deployment
metadata:
  name: sql-server
  namespace: sre
spec:
  replicas: 1
  selector:
    matchLabels:
      name: sql-server
  template:
    metadata:
      labels:
        name: sql-server
    spec:
      containers:
      - name: sql-server
        image: mcr.microsoft.com/mssql/server:2019-latest
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 1433
        env:
        - name: ACCEPT_EULA
          value: Y
        - name: MSSQL_SA_PASSWORD
          value: "msserver@123456"
        volumeMounts:
        - name: sql-pvc
          mountPath: /usr/src/mmsql
      volumes:
       - name: sql-pvc
         persistentVolumeClaim:
           claimName: sql-server-data

svc

kind: Service
apiVersion: v1
metadata:
  name: sql-server
  namespace: sre
spec:
  ports:
  - name: mongo
    port: 1433
    targetPort: 1433
    protocol: TCP
  selector:
    name: sql-server

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code