Skip to content

Instantly share code, notes, and snippets.

@nashmaniac
Created May 9, 2020 01:25
Show Gist options
  • Save nashmaniac/6cd2d27d0534e5b4fb68ccace7b0ff29 to your computer and use it in GitHub Desktop.
Save nashmaniac/6cd2d27d0534e5b4fb68ccace7b0ff29 to your computer and use it in GitHub Desktop.
2-traffic-management/2-user-microservice.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: user-deployment # make sure the name of two deployment to be different
namespace: traffic-management # setting namespace to default
labels:
app: user
spec:
replicas: 1 #setting replica count to 1
selector:
matchLabels:
app: user
template:
metadata:
name: user-template
labels:
app: user
version: v1 # adding version to group all the version pods.
spec:
containers:
- name: user-microservice-container
image: gcr.io/nomadic-mesh/microservice/user:v1 #image changed
imagePullPolicy: Always
env:
- name: APP_NAME
value: "User V1"
- name: VERSION # Introduced new version
value: "v1"
ports:
- containerPort: 8000
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: user-deployment-v2 # making unique name for the deployment
namespace: traffic-management
labels:
app: user
spec:
replicas: 1 #setting replica count to 1
selector:
matchLabels:
app: user
template:
metadata:
name: user-template
labels:
app: user
version: v2 # setting version to v2
spec:
containers:
- name: user-microservice-container
image: gcr.io/nomadic-mesh/microservice/user:v2 #new image
imagePullPolicy: Always
env:
- name: APP_NAME
value: "User V2"
- name: VERSION # added version
value: "v2"
ports:
- containerPort: 8000
---
apiVersion: v1
kind: Service
metadata:
name: user-service
namespace: traffic-management
spec:
selector:
app: user
ports:
- port: 8000
targetPort: 8000
name: http-user-service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment