|
| 1 | +apiVersion: v1 |
| 2 | +kind: Namespace |
| 3 | +metadata: |
| 4 | + name: petclinic |
| 5 | +--- |
| 6 | +kind: StorageClass |
| 7 | +apiVersion: storage.k8s.io/v1 |
| 8 | +metadata: |
| 9 | + name: px-repl2-sc |
| 10 | +provisioner: pxd.portworx.com |
| 11 | +parameters: |
| 12 | + #openstorage.io/auth-secret-name: px-user-token |
| 13 | + #openstorage.io/auth-secret-namespace: portworx |
| 14 | + repl: "2" |
| 15 | + io_profile: "db_remote" |
| 16 | +--- |
| 17 | +kind: PersistentVolumeClaim |
| 18 | +apiVersion: v1 |
| 19 | +metadata: |
| 20 | + namespace: petclinic |
| 21 | + name: petclinic-db-mysql |
| 22 | +spec: |
| 23 | + storageClassName: px-repl2-sc |
| 24 | + accessModes: |
| 25 | + - ReadWriteOnce |
| 26 | + resources: |
| 27 | + requests: |
| 28 | + storage: 8Gi |
| 29 | +--- |
| 30 | +apiVersion: v1 |
| 31 | +kind: Service |
| 32 | +metadata: |
| 33 | + namespace: petclinic |
| 34 | + creationTimestamp: null |
| 35 | + labels: |
| 36 | + app: petclinic-db-mysql |
| 37 | + name: petclinic-db-mysql |
| 38 | + selfLink: /api/v1/namespaces/default/services/petclinic-db-mysql |
| 39 | +spec: |
| 40 | + ports: |
| 41 | + - name: mysql |
| 42 | + port: 3306 |
| 43 | + protocol: TCP |
| 44 | + targetPort: mysql |
| 45 | + selector: |
| 46 | + app: petclinic-db-mysql |
| 47 | + sessionAffinity: None |
| 48 | + type: ClusterIP |
| 49 | +--- |
| 50 | +kind: Service |
| 51 | +apiVersion: v1 |
| 52 | +metadata: |
| 53 | + name: petclinic |
| 54 | + namespace: petclinic |
| 55 | + annotations: |
| 56 | + service.beta.kubernetes.io/aws-load-balancer-type: "external" |
| 57 | + labels: |
| 58 | + app: petclinic |
| 59 | +spec: |
| 60 | + type: LoadBalancer |
| 61 | + ports: |
| 62 | + - name: http |
| 63 | + protocol: TCP |
| 64 | + port: 80 |
| 65 | + targetPort: 8080 |
| 66 | + nodePort: 30333 |
| 67 | + selector: |
| 68 | + app: petclinic |
| 69 | +--- |
| 70 | +apiVersion: apps/v1 |
| 71 | +kind: Deployment |
| 72 | +metadata: |
| 73 | + name: petclinic |
| 74 | + namespace: petclinic |
| 75 | + labels: |
| 76 | + app: petclinic |
| 77 | +spec: |
| 78 | + replicas: 1 |
| 79 | + selector: |
| 80 | + matchLabels: |
| 81 | + app: petclinic |
| 82 | + template: |
| 83 | + metadata: |
| 84 | + labels: |
| 85 | + app: petclinic |
| 86 | + spec: |
| 87 | + schedulerName: stork |
| 88 | + containers: |
| 89 | + - name: petclinic |
| 90 | + image: springdeveloper/spring-petclinic:2.0.0.BUILD-SNAPSHOT |
| 91 | + imagePullPolicy: IfNotPresent |
| 92 | + ports: |
| 93 | + - containerPort: 80 |
| 94 | + livenessProbe: |
| 95 | + httpGet: |
| 96 | + path: /manage/health |
| 97 | + port: 8080 |
| 98 | + initialDelaySeconds: 60 |
| 99 | + periodSeconds: 5 |
| 100 | + readinessProbe: |
| 101 | + httpGet: |
| 102 | + path: /manage/health |
| 103 | + port: 8080 |
| 104 | + initialDelaySeconds: 15 |
| 105 | + periodSeconds: 5 |
| 106 | + env: |
| 107 | + - name: SPRING_PROFILES_ACTIVE |
| 108 | + value: 'production,kubernetes' |
| 109 | + - name: MYSQL_HOST |
| 110 | + value: petclinic-db-mysql |
| 111 | + - name: MYSQL_USERNAME |
| 112 | + value: root |
| 113 | + - name: MYSQL_PASSWORD |
| 114 | + value: supermysql |
| 115 | +--- |
| 116 | +apiVersion: apps/v1 |
| 117 | +kind: Deployment |
| 118 | +metadata: |
| 119 | + namespace: petclinic |
| 120 | + annotations: |
| 121 | + deployment.kubernetes.io/revision: "1" |
| 122 | + creationTimestamp: null |
| 123 | + generation: 1 |
| 124 | + labels: |
| 125 | + app: petclinic-db-mysql |
| 126 | + name: petclinic-db-mysql |
| 127 | +spec: |
| 128 | + replicas: 1 |
| 129 | + selector: |
| 130 | + matchLabels: |
| 131 | + app: petclinic-db-mysql |
| 132 | + strategy: |
| 133 | + rollingUpdate: |
| 134 | + maxSurge: 1 |
| 135 | + maxUnavailable: 1 |
| 136 | + type: RollingUpdate |
| 137 | + template: |
| 138 | + metadata: |
| 139 | + creationTimestamp: null |
| 140 | + labels: |
| 141 | + app: petclinic-db-mysql |
| 142 | + spec: |
| 143 | + schedulerName: stork |
| 144 | + containers: |
| 145 | + - env: |
| 146 | + - name: MYSQL_ROOT_PASSWORD |
| 147 | + value: supermysql |
| 148 | + - name: MYSQL_PASSWORD |
| 149 | + value: supermysql |
| 150 | + - name: MYSQL_USER |
| 151 | + - name: MYSQL_DATABASE |
| 152 | + value: petclinic |
| 153 | + image: mysql:5.7.33 |
| 154 | + imagePullPolicy: IfNotPresent |
| 155 | + livenessProbe: |
| 156 | + exec: |
| 157 | + command: |
| 158 | + - sh |
| 159 | + - -c |
| 160 | + - mysqladmin ping -u root -p${MYSQL_ROOT_PASSWORD} |
| 161 | + failureThreshold: 3 |
| 162 | + initialDelaySeconds: 30 |
| 163 | + periodSeconds: 10 |
| 164 | + successThreshold: 1 |
| 165 | + timeoutSeconds: 5 |
| 166 | + name: petclinic-db-mysql |
| 167 | + ports: |
| 168 | + - containerPort: 3306 |
| 169 | + name: mysql |
| 170 | + protocol: TCP |
| 171 | + readinessProbe: |
| 172 | + exec: |
| 173 | + command: |
| 174 | + - sh |
| 175 | + - -c |
| 176 | + - mysqladmin ping -u root -p${MYSQL_ROOT_PASSWORD} |
| 177 | + failureThreshold: 3 |
| 178 | + initialDelaySeconds: 5 |
| 179 | + periodSeconds: 10 |
| 180 | + successThreshold: 1 |
| 181 | + timeoutSeconds: 1 |
| 182 | + resources: |
| 183 | + requests: |
| 184 | + cpu: 100m |
| 185 | + memory: 256Mi |
| 186 | + terminationMessagePath: /dev/termination-log |
| 187 | + terminationMessagePolicy: File |
| 188 | + volumeMounts: |
| 189 | + - mountPath: /var/lib/mysql |
| 190 | + name: data |
| 191 | + dnsPolicy: ClusterFirst |
| 192 | + initContainers: |
| 193 | + - command: |
| 194 | + - rm |
| 195 | + - -fr |
| 196 | + - /var/lib/mysql/lost+found |
| 197 | + image: busybox:1.29.3 |
| 198 | + imagePullPolicy: IfNotPresent |
| 199 | + name: remove-lost-found |
| 200 | + resources: |
| 201 | + requests: |
| 202 | + cpu: 10m |
| 203 | + memory: 10Mi |
| 204 | + terminationMessagePath: /dev/termination-log |
| 205 | + terminationMessagePolicy: File |
| 206 | + volumeMounts: |
| 207 | + - mountPath: /var/lib/mysql |
| 208 | + name: data |
| 209 | + restartPolicy: Always |
| 210 | + securityContext: {} |
| 211 | + terminationGracePeriodSeconds: 30 |
| 212 | + volumes: |
| 213 | + - name: data |
| 214 | + persistentVolumeClaim: |
| 215 | + claimName: petclinic-db-mysql |
0 commit comments