Created
June 30, 2020 03:47
-
-
Save franknmungai/a06f565241225ec2b0a8d61169126724 to your computer and use it in GitHub Desktop.
Google Clould Kubernetes setup for ticketing-app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment #Depl for managing pods | |
metadata: | |
name: auth-depl | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: # Manage pods with this labels | |
app: auth | |
template: #Teplate for our pod | |
metadata: | |
labels: | |
app: auth | |
spec: | |
containers: | |
- name: auth | |
image: us.gcr.io/great-places-1576325098496/auth #Docker image, managed by googleCloudBuild | |
env: #environment variables | |
- name: JWT_KEY # The name of this variable in our container | |
valueFrom: | |
secretKeyRef: # The secret source for the variable | |
name: jwt-secret | |
key: JWT_KEY | |
resources: | |
limits: | |
memory: "128Mi" | |
cpu: "200m" | |
--- | |
#Cluster IP Service to allow incoming network traffic from the cluster | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: auth-srv | |
spec: | |
selector: | |
app: auth | |
ports: | |
- name: auth | |
protocol: TCP | |
port: 3000 #The port for accessing this pod | |
targetPort: 3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: auth-mongo-depl | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: auth-mongo | |
template: | |
metadata: | |
labels: | |
app: auth-mongo | |
spec: | |
containers: #The containers we want to run in this pod managed by this depl | |
- name: auth-mongo | |
image: mongo | |
resources: | |
limits: | |
memory: "128Mi" | |
cpu: "1Gi" | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: auth-mongo-srv | |
spec: | |
selector: | |
app: auth-mongo | |
ports: | |
- name: db | |
protocol: TCP | |
port: 27017 | |
targetPort: 27017 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: client-depl | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: client | |
template: | |
metadata: | |
labels: | |
app: client | |
spec: | |
containers: | |
- name: client | |
image: us.gcr.io/great-places-1576325098496/client | |
resources: | |
limits: | |
memory: "128Mi" | |
cpu: "250m" | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: client-srv | |
spec: | |
selector: | |
app: client | |
ports: | |
- name: client | |
protocol: TCP | |
port: 3000 | |
targetPort: 3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: extensions/v1beta1 | |
kind: Ingress | |
metadata: | |
name: ingress-service | |
annotations: | |
kubernetes.io/ingress.class: nginx | |
nginx.ingress.kubernetes.io/use-regex: "true" | |
spec: | |
rules: | |
- host: ticketing.dev | |
http: | |
paths: | |
- path: /api/users/?(.*) | |
backend: | |
serviceName: auth-srv | |
servicePort: 3000 | |
- path: /?(.*) | |
backend: | |
serviceName: client-srv | |
servicePort: 3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: skaffold/v2alpha3 | |
kind: Config | |
deploy: | |
kubectl: | |
manifests: #Our k8s set up | |
- ./infra/k8s/* | |
build: | |
googleCloudBuild: | |
projectId: great-places-1576325098496 | |
artifacts: | |
- image: us.gcr.io/great-places-1576325098496/auth | |
context: auth | |
docker: | |
dockerfile: Dockerfile | |
sync: | |
manual: #Files to watch | |
- src: "src/**/*.ts" | |
dest: . | |
- image: us.gcr.io/great-places-1576325098496/client | |
context: client | |
docker: | |
dockerfile: Dockerfile | |
sync: | |
manual: #Files to watch | |
- src: "**/*.js" | |
dest: . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment