diff --git a/k8s-specifications/db-deployment.yaml b/k8s-specifications/db-deployment.yaml index 3fff55b..f552a75 100644 --- a/k8s-specifications/db-deployment.yaml +++ b/k8s-specifications/db-deployment.yaml @@ -1,10 +1,15 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: + labels: + app: db name: db namespace: vote spec: replicas: 1 + selector: + matchLabels: + app: db template: metadata: labels: @@ -12,7 +17,10 @@ spec: spec: containers: - image: postgres:9.4 - name: db + name: postgres + ports: + - containerPort: 5432 + name: postgres volumeMounts: - mountPath: /var/lib/postgresql/data name: db-data diff --git a/k8s-specifications/db-service.yaml b/k8s-specifications/db-service.yaml index c4b2568..ba64baf 100644 --- a/k8s-specifications/db-service.yaml +++ b/k8s-specifications/db-service.yaml @@ -1,12 +1,15 @@ apiVersion: v1 kind: Service metadata: + labels: + app: db name: db namespace: vote spec: type: ClusterIP ports: - - port: 5432 + - name: "db-service" + port: 5432 targetPort: 5432 selector: app: db diff --git a/k8s-specifications/redis-deployment.yaml b/k8s-specifications/redis-deployment.yaml index d067027..53fe35c 100644 --- a/k8s-specifications/redis-deployment.yaml +++ b/k8s-specifications/redis-deployment.yaml @@ -1,10 +1,15 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: + labels: + app: redis name: redis namespace: vote spec: replicas: 1 + selector: + matchLabels: + app: redis template: metadata: labels: @@ -13,6 +18,9 @@ spec: containers: - image: redis:alpine name: redis + ports: + - containerPort: 6379 + name: redis volumeMounts: - mountPath: /data name: redis-data diff --git a/k8s-specifications/redis-service.yaml b/k8s-specifications/redis-service.yaml index 149be37..050c66c 100644 --- a/k8s-specifications/redis-service.yaml +++ b/k8s-specifications/redis-service.yaml @@ -1,12 +1,15 @@ apiVersion: v1 kind: Service metadata: + labels: + app: redis name: redis namespace: vote spec: type: ClusterIP ports: - - port: 6379 + - name: "redis-service" + port: 6379 targetPort: 6379 selector: app: redis diff --git a/k8s-specifications/result-deployment.yaml b/k8s-specifications/result-deployment.yaml index e07dd74..9939db1 100644 --- a/k8s-specifications/result-deployment.yaml +++ b/k8s-specifications/result-deployment.yaml @@ -1,10 +1,15 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: + labels: + app: result name: result namespace: vote spec: replicas: 1 + selector: + matchLabels: + app: result template: metadata: labels: @@ -13,3 +18,6 @@ spec: containers: - image: dockersamples/examplevotingapp_result:before name: result + ports: + - containerPort: 80 + name: result diff --git a/k8s-specifications/result-service.yaml b/k8s-specifications/result-service.yaml index ec45551..14a8760 100644 --- a/k8s-specifications/result-service.yaml +++ b/k8s-specifications/result-service.yaml @@ -1,6 +1,8 @@ apiVersion: v1 kind: Service metadata: + labels: + app: result name: result namespace: vote spec: diff --git a/k8s-specifications/vote-deployment.yaml b/k8s-specifications/vote-deployment.yaml index 7511c37..c2120d4 100644 --- a/k8s-specifications/vote-deployment.yaml +++ b/k8s-specifications/vote-deployment.yaml @@ -1,10 +1,15 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: + labels: + app: vote name: vote namespace: vote spec: replicas: 1 + selector: + matchLabels: + app: vote template: metadata: labels: @@ -13,3 +18,6 @@ spec: containers: - image: dockersamples/examplevotingapp_vote:before name: vote + ports: + - containerPort: 80 + name: vote diff --git a/k8s-specifications/vote-service.yaml b/k8s-specifications/vote-service.yaml index d0caed4..c9d4972 100644 --- a/k8s-specifications/vote-service.yaml +++ b/k8s-specifications/vote-service.yaml @@ -1,6 +1,8 @@ apiVersion: v1 kind: Service metadata: + labels: + app: vote name: vote namespace: vote spec: diff --git a/k8s-specifications/worker-deployment.yaml b/k8s-specifications/worker-deployment.yaml index 10f3027..d564078 100644 --- a/k8s-specifications/worker-deployment.yaml +++ b/k8s-specifications/worker-deployment.yaml @@ -1,10 +1,15 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: + labels: + app: worker name: worker namespace: vote spec: replicas: 1 + selector: + matchLabels: + app: db template: metadata: labels: diff --git a/kube-deployment.yml b/kube-deployment.yml index 0b03da9..e56956c 100644 --- a/kube-deployment.yml +++ b/kube-deployment.yml @@ -1,3 +1,4 @@ +# redis --- apiVersion: v1 kind: Service @@ -8,23 +9,23 @@ metadata: spec: clusterIP: None ports: - - name: redis - port: 6379 - targetPort: 6379 + - name: redis-service + port: 6379 + targetPort: 6379 selector: app: redis --- -apiVersion: apps/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: redis labels: app: redis spec: + replicas: 1 selector: matchLabels: app: redis - replicas: 1 template: metadata: labels: @@ -37,6 +38,7 @@ spec: - containerPort: 6379 name: redis +# db --- apiVersion: v1 kind: Service @@ -47,43 +49,44 @@ metadata: spec: clusterIP: None ports: - - - name: db - port: 5432 - targetPort: 5432 + - name: db + port: 5432 + targetPort: 5432 selector: app: db --- -apiVersion: apps/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: db - # labels: - # app: db + labels: + app: db spec: + replicas: 1 + selector: + matchLabels: + app: db template: metadata: labels: app: db spec: containers: - - + - name: db + image: postgres:9.4 + env: + - name: PGDATA + value: /var/lib/postgresql/data/pgdata + ports: + - containerPort: 5432 name: db - image: postgres:9.4 - env: - - name: PGDATA - value: /var/lib/postgresql/data/pgdata - ports: - - containerPort: 5432 - name: db - volumeMounts: - - name: db-data - mountPath: /var/lib/postgresql/data - volumes: + volumeMounts: - name: db-data - persistentVolumeClaim: - claimName: postgres-pv-claim - + mountPath: /var/lib/postgresql/data + volumes: + - name: db-data + persistentVolumeClaim: + claimName: postgres-pv-claim --- apiVersion: v1 kind: PersistentVolumeClaim @@ -96,6 +99,7 @@ spec: requests: storage: 1Gi +# result --- apiVersion: v1 kind: Service @@ -106,15 +110,13 @@ metadata: spec: type: LoadBalancer ports: - - - port: 5001 - targetPort: 80 - name: result + - port: 5001 + targetPort: 80 + name: result-service selector: app: result - # clusterIP: None --- -apiVersion: apps/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: result @@ -122,6 +124,9 @@ metadata: app: result spec: replicas: 1 + selector: + matchLabels: + app: result template: metadata: labels: @@ -134,6 +139,7 @@ spec: - containerPort: 80 name: result +# vote --- apiVersion: v1 kind: Service @@ -146,12 +152,11 @@ spec: ports: - port: 5000 targetPort: 80 - name: vote + name: vote-service selector: app: vote - # clusterIP: None --- -apiVersion: apps/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: vote @@ -159,19 +164,22 @@ metadata: app: vote spec: replicas: 2 + selector: + matchLabels: + app: vote template: metadata: labels: app: vote spec: containers: - - name: vote - image: dockersamples/examplevotingapp_vote:before - ports: - - - containerPort: 80 - name: vote - + - name: vote + image: dockersamples/examplevotingapp_vote:before + ports: + - containerPort: 80 + name: vote + +# worker --- apiVersion: v1 kind: Service @@ -184,7 +192,7 @@ spec: selector: app: worker --- -apiVersion: apps/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: labels: @@ -192,12 +200,14 @@ metadata: name: worker spec: replicas: 1 + selector: + matchLabels: + app: worker template: metadata: labels: app: worker spec: containers: - - - image: dockersamples/examplevotingapp_worker - name: worker + - image: dockersamples/examplevotingapp_worker + name: worker