diff --git a/manifest/deployment.yml b/manifest/deployment.yml new file mode 100644 index 0000000..950a711 --- /dev/null +++ b/manifest/deployment.yml @@ -0,0 +1,44 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: myapp +spec: + replicas: 2 + selector: + matchLabels: + app: myapp + template: + metadata: + labels: + app: myapp + spec: + containers: + - name: app-container + image: harikan65/docker-webapp:appimage + ports: + - containerPort: 8080 + env: + - name: SPRING_DATASOURCE_URL + value: jdbc:mysql://devopsdb:3306/accounts + - name: SPRING_DATASOURCE_USERNAME + value: root + - name: SPRING_DATASOURCE_PASSWORD + value: devopspassword + + + +--- +apiVersion: v1 +kind: Service +metadata: + name: devopsapp +spec: + type: LoadBalancer + selector: + app: myapp + ports: + - port: 8080 + targetPort: 8080 + + diff --git a/manifest/secret.yml.disabled b/manifest/secret.yml.disabled new file mode 100644 index 0000000..376f7a5 --- /dev/null +++ b/manifest/secret.yml.disabled @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: Secret +metadata: + name: db-secret +type: Opaque +data: + username: cm9vdA== # echo -n 'mysql' | base64 + password: ZGV2b3BzcGFzc3dvcmQ= # echo -n 'mypassw' | base64 + diff --git a/manifest/statefulset.yml b/manifest/statefulset.yml new file mode 100644 index 0000000..1c4ca43 --- /dev/null +++ b/manifest/statefulset.yml @@ -0,0 +1,40 @@ +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: mysql +spec: + replicas: 2 + selector: + matchLabels: + app: mydb + template: + metadata: + labels: + app: mydb + spec: + containers: + - name: db-container + image: harikan65/docker-webapp:dbimage + ports: + - containerPort: 3306 + env: + - name: MYSQL_ROOT_PASSWORD + value: "devopspassword" + - name: MYSQL_DATABASE + value: "accounts" + +--- +apiVersion: v1 +kind: Service +metadata: + name: devopsdb +spec: + clusterIP: None + selector: + app: mydb + ports: + - port: 3306 + targetPort: 3306 + +