github.com/GoogleContainerTools/kpt@v1.0.0-beta.50.0.20240520170205-c25345ffcbee/package-examples/wordpress/mysql/deployment.yaml (about)

     1  # Copyright 2021 The kpt Authors
     2  #
     3  # Licensed under the Apache License, Version 2.0 (the "License");
     4  # you may not use this file except in compliance with the License.
     5  # You may obtain a copy of the License at
     6  #
     7  #      http://www.apache.org/licenses/LICENSE-2.0
     8  #
     9  # Unless required by applicable law or agreed to in writing, software
    10  # distributed under the License is distributed on an "AS IS" BASIS,
    11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  # See the License for the specific language governing permissions and
    13  # limitations under the License.
    14  apiVersion: v1
    15  kind: Service
    16  metadata:
    17    name: wordpress-mysql
    18    labels:
    19      app: wordpress
    20      tier: mysql
    21  spec:
    22    selector:
    23      app: wordpress
    24      tier: mysql
    25    ports:
    26      - protocol: TCP
    27        port: 3306
    28    clusterIP: None
    29  ---
    30  apiVersion: v1
    31  kind: PersistentVolumeClaim
    32  metadata:
    33    name: mysql-pv-claim
    34    labels:
    35      app: wordpress
    36      tier: mysql
    37  spec:
    38    resources:
    39      requests:
    40        storage: 20Gi
    41    accessModes:
    42      - ReadWriteOnce
    43  ---
    44  apiVersion: apps/v1
    45  kind: Deployment
    46  metadata:
    47    name: wordpress-mysql
    48    labels:
    49      app: wordpress
    50      tier: mysql
    51  spec:
    52    selector:
    53      matchLabels:
    54        app: wordpress
    55        tier: mysql
    56    template:
    57      metadata:
    58        labels:
    59          app: wordpress
    60          tier: mysql
    61      spec:
    62        containers:
    63          - name: mysql
    64            image: mysql:5.6
    65            ports:
    66              - name: mysql
    67                protocol: TCP
    68                containerPort: 3306
    69            env:
    70              - name: MYSQL_ROOT_PASSWORD
    71                valueFrom:
    72                  secretKeyRef:
    73                    name: mysql-pass
    74                    key: password
    75            volumeMounts:
    76              - name: mysql-persistent-storage
    77                mountPath: /var/lib/mysql
    78        volumes:
    79          - name: mysql-persistent-storage
    80            persistentVolumeClaim:
    81              claimName: mysql-pv-claim
    82    strategy:
    83      type: Recreate