Skip to content

Instantly share code, notes, and snippets.

@khaosdoctor
Last active April 8, 2021 15:06
Show Gist options
  • Save khaosdoctor/0156d5fd13672704e2739232e89c2f5c to your computer and use it in GitHub Desktop.
Save khaosdoctor/0156d5fd13672704e2739232e89c2f5c to your computer and use it in GitHub Desktop.
Material do grupo de estudos do livro de kubernetes da casa do código
apiVersion: v1
kind: Pod
metadata:
name: app
labels:
name: app
spec:
containers:
- name: app-ctr
image: khaosdoctor/go-vote-api
resources:
requests:
memory: "64Mi"
cpu: "100m"
limits:
memory: "128Mi"
cpu: "500m"
readinessProbe:
initialDelaySeconds: 5
timeoutSeconds: 5
httpGet:
path: /votes
port: 8080
livenessProbe:
failureThreshold: 1
httpGet:
path: /votes
port: 8080
periodSeconds: 10
timeoutSeconds: 5
initialDelaySeconds: 15
ports:
- containerPort: 8080
name: http
apiVersion: v1
kind: Pod
metadata:
name: vote-api
labels:
app: vote-api
spec:
containers:
- name: vote-api
image: khaosdoctor/go-vote-api
resources:
limits:
memory: "128Mi"
cpu: "500m"
readinessProbe:
initialDelaySeconds: 5
timeoutSeconds: 5
httpGet:
path: /votes
port: 8080
livenessProbe:
failureThreshold: 1
httpGet:
path: /votes
port: 8080
periodSeconds: 10
timeoutSeconds: 5
initialDelaySeconds: 15
ports:
- containerPort: 8080
name: http
- name: vote-api-voter
image: curlimages/curl
command: ["/bin/sh"]
args: [
"-c",
"while true; do wget -O- http://localhost:8080/votes/Lucas; sleep 3; done"
]
resources:
limits:
memory: "128Mi"
cpu: "100m"
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: vote-api
spec:
replicas: 3
selector:
matchLabels:
name: vote-api
template:
metadata:
name: vote-api
labels:
name: vote-api
spec:
containers:
- name: vote-api
image: khaosdoctor/go-vote-api
resources:
limits:
memory: "128Mi"
cpu: "500m"
readinessProbe:
initialDelaySeconds: 5
timeoutSeconds: 5
httpGet:
path: /votes
port: 8080
livenessProbe:
failureThreshold: 1
httpGet:
path: /votes
port: 8080
periodSeconds: 10
timeoutSeconds: 5
initialDelaySeconds: 15
ports:
- containerPort: 8080
apiVersion: apps/v1
kind: Deployment
metadata:
name: vote-api
labels:
name: vote-api
spec:
replicas: 3
minReadySeconds: 10
revisionHistoryLimit: 3
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
selector:
matchLabels:
name: vote-api
template:
metadata:
name: vote-api
labels:
name: vote-api
spec:
containers:
- name: vote-api
image: khaosdoctor/go-vote-api
resources:
limits:
memory: "128Mi"
cpu: "500m"
readinessProbe:
initialDelaySeconds: 10
timeoutSeconds: 5
httpGet:
path: /votes
port: 8080
livenessProbe:
failureThreshold: 1
httpGet:
path: /votes
port: 8080
periodSeconds: 10
timeoutSeconds: 5
initialDelaySeconds: 10
ports:
- containerPort: 8080
#!/bin/bash
az aks enable-addons -g cdc -n cdc --addons http_application_routing
az aks show -n cdc -g cdc --query addonProfiles.httpApplicationRouting.configHTTPApplicationRoutingZoneName -o tsv
apiVersion: apps/v1
kind: Deployment
metadata:
name: vote-api
labels:
name: vote-api
spec:
replicas: 3
minReadySeconds: 10
revisionHistoryLimit: 3
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
selector:
matchLabels:
name: vote-api
template:
metadata:
name: vote-api
labels:
name: vote-api
spec:
containers:
- name: vote-api
image: khaosdoctor/go-vote-api
resources:
limits:
memory: "128Mi"
cpu: "500m"
readinessProbe:
initialDelaySeconds: 10
timeoutSeconds: 5
httpGet:
path: /votes
port: 8080
livenessProbe:
failureThreshold: 1
httpGet:
path: /votes
port: 8080
periodSeconds: 10
timeoutSeconds: 5
initialDelaySeconds: 10
ports:
- containerPort: 8080
name: http
kind: Service
apiVersion: v1
metadata:
name: vote-api
spec:
selector:
name: vote-api
ports:
- name: http
port: 80
targetPort: 8080
kind: Service
apiVersion: v1
metadata:
name: vote-api
spec:
selector:
name: vote-api
type: NodePort
ports:
- name: http
port: 80
targetPort: 8080
kind: Service
apiVersion: v1
metadata:
name: vote-api
spec:
selector:
name: vote-api
type: LoadBalancer
ports:
- name: http
port: 80
targetPort: 8080
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: vote-api
annotations:
kubernetes.io/ingress.class: addon-http-application-routing
spec:
rules:
- host: vote-api.e6a2d2a17fdc406c8f66.eastus.aksapp.io
http:
paths:
- path: /
backend:
serviceName: vote-api
servicePort: http
apiVersion: apps/v1
kind: Deployment
metadata:
name: ship-manager-backend
spec:
replicas: 1
selector:
matchLabels:
app: ship-manager-backend
template:
metadata:
labels:
app: ship-manager-backend
spec:
containers:
- image: mcr.microsoft.com/mslearn/samples/contoso-ship-manager:backend
name: ship-manager-backend
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 3000
name: http
env:
- name: DATABASE_MONGODB_URI
value: mongodb://ship-manager:[email protected]/ship-manager?authSource=admin
- name: DATABASE_MONGODB_DBNAME
value: ship_manager
---
apiVersion: v1
kind: Service
metadata:
name: ship-manager-backend
spec:
selector:
app: ship-manager-backend
ports:
- name: http
port: 80
targetPort: 3000
# ---
# apiVersion: networking.k8s.io/v1beta1
# kind: Ingress
# metadata:
# name: ship-manager-backend
# annotations:
# kubernetes.io/ingress.class: addon-http-application-routing
# spec:
# rules:
# - host: ship-manager-backend.e6a2d2a17fdc406c8f66.eastus.aksapp.io
# http:
# paths:
# - path: /
# backend:
# serviceName: ship-manager-backend
# servicePort: http
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ship-manager-database
spec:
replicas: 1
selector:
matchLabels:
app: ship-manager-database
template:
metadata:
labels:
app: ship-manager-database
spec:
containers:
- image: mongo
name: ship-manager-database
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
ports:
- containerPort: 27017
name: mongo
env:
- name: MONGO_INITDB_ROOT_USERNAME
value: ship-manager
- name: MONGO_INITDB_ROOT_PASSWORD
value: s3cr3tp4s5
---
apiVersion: v1
kind: Service
metadata:
name: ship-manager-database
spec:
selector:
app: ship-manager-database
ports:
- port: 27017
targetPort: mongo
apiVersion: apps/v1
kind: Deployment
metadata:
name: ship-manager-frontend
spec:
replicas: 1
selector:
matchLabels:
app: ship-manager-frontend
template:
metadata:
labels:
app: ship-manager-frontend
spec:
containers:
- image: mcr.microsoft.com/mslearn/samples/contoso-ship-manager:frontend
name: ship-manager-frontend
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 80
name: http
volumeMounts:
- name: config
mountPath: /usr/src/app/dist/config.js
subPath: config.js
volumes:
- name: config
configMap:
name: frontend-config
---
apiVersion: v1
kind: Service
metadata:
name: ship-manager-frontend
spec:
selector:
app: ship-manager-frontend
ports:
- name: http
port: 80
targetPort: 80
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: ship-manager-frontend
annotations:
kubernetes.io/ingress.class: addon-http-application-routing
spec:
rules:
- host: ship-manager-frontend.e6a2d2a17fdc406c8f66.eastus.aksapp.io
http:
paths:
- path: /
backend:
serviceName: ship-manager-frontend
servicePort: http
---
apiVersion: v1
kind: ConfigMap
metadata:
name: frontend-config
data:
config.js: |
const config = (() => {
return {
'VUE_APP_BACKEND_BASE_URL': 'http://ship-manager-backend.e6a2d2a17fdc406c8f66.eastus.aksapp.io',
}
})()
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: apis
annotations:
kubernetes.io/ingress.class: addon-http-application-routing
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: apis.e6a2d2a17fdc406c8f66.eastus.aksapp.io
http:
paths:
- path: /voteapi
backend:
serviceName: vote-api
servicePort: http
- path: /shipm
backend:
serviceName: ship-manager-backend
servicePort: http
apiVersion: apps/v1
kind: Deployment
metadata:
name: ship-manager-backend
spec:
replicas: 1
selector:
matchLabels:
app: ship-manager-backend
template:
metadata:
labels:
app: ship-manager-backend
spec:
containers:
- image: mcr.microsoft.com/mslearn/samples/contoso-ship-manager:backend
name: ship-manager-backend
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 3000
name: http
env:
- name: DATABASE_MONGODB_URI
value: mongodb://ship-manager:[email protected]/ship-manager?authSource=admin
- name: DATABASE_MONGODB_DBNAME
value: ship_manager
---
apiVersion: v1
kind: Service
metadata:
name: ship-manager-backend
spec:
selector:
app: ship-manager-backend
ports:
- name: http
port: 80
targetPort: 3000
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: ship-manager-backend
annotations:
kubernetes.io/ingress.class: addon-http-application-routing
spec:
rules:
- host: ship-manager-backend.e6a2d2a17fdc406c8f66.eastus.aksapp.io
http:
paths:
- path: /
backend:
serviceName: ship-manager-backend
servicePort: http
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ship-manager-database
spec:
replicas: 1
selector:
matchLabels:
app: ship-manager-database
template:
metadata:
labels:
app: ship-manager-database
spec:
containers:
- image: mongo
name: ship-manager-database
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
ports:
- containerPort: 27017
name: mongo
env:
- name: MONGO_INITDB_ROOT_USERNAME
value: ship-manager
- name: MONGO_INITDB_ROOT_PASSWORD
value: s3cr3tp4s5
---
apiVersion: v1
kind: Service
metadata:
name: ship-manager-database
spec:
selector:
app: ship-manager-database
ports:
- port: 27017
targetPort: mongo
apiVersion: apps/v1
kind: Deployment
metadata:
name: ship-manager-frontend
spec:
replicas: 1
selector:
matchLabels:
app: ship-manager-frontend
template:
metadata:
labels:
app: ship-manager-frontend
spec:
containers:
- image: mcr.microsoft.com/mslearn/samples/contoso-ship-manager:frontend
name: ship-manager-frontend
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 80
name: http
volumeMounts:
- name: config
mountPath: /usr/src/app/dist/config.js
subPath: config.js
volumes:
- name: config
configMap:
name: frontend-config
---
apiVersion: v1
kind: Service
metadata:
name: ship-manager-frontend
spec:
selector:
app: ship-manager-frontend
ports:
- name: http
port: 80
targetPort: 80
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: ship-manager-frontend
annotations:
kubernetes.io/ingress.class: addon-http-application-routing
spec:
rules:
- host: ship-manager-frontend.e6a2d2a17fdc406c8f66.eastus.aksapp.io
http:
paths:
- path: /
backend:
serviceName: ship-manager-frontend
servicePort: http
---
apiVersion: v1
kind: ConfigMap
metadata:
name: frontend-config
data:
config.js: |
const config = (() => {
return {
'VUE_APP_BACKEND_BASE_URL': 'http://ship-manager-backend.e6a2d2a17fdc406c8f66.eastus.aksapp.io',
}
})()
apiVersion: v1
kind: Secret
metadata:
name: ship-manager-backend
type: Opaque
stringData:
database_mongodb_uri: mongodb://ship-manager:[email protected]/ship-manager?authSource=admin
apiVersion: apps/v1
kind: Deployment
metadata:
name: ship-manager-backend
spec:
replicas: 1
selector:
matchLabels:
app: ship-manager-backend
template:
metadata:
labels:
app: ship-manager-backend
spec:
containers:
- image: mcr.microsoft.com/mslearn/samples/contoso-ship-manager:backend
name: ship-manager-backend
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 3000
name: http
env:
- name: DATABASE_MONGODB_URI
valueFrom:
secretKeyRef:
key: database_mongodb_uri
name: ship-manager-backend
- name: DATABASE_MONGODB_DBNAME
value: ship_manager
---
apiVersion: v1
kind: Service
metadata:
name: ship-manager-backend
spec:
selector:
app: ship-manager-backend
ports:
- name: http
port: 80
targetPort: 3000
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: ship-manager-backend
annotations:
kubernetes.io/ingress.class: addon-http-application-routing
spec:
rules:
- host: ship-manager-backend.e6a2d2a17fdc406c8f66.eastus.aksapp.io
http:
paths:
- path: /
backend:
serviceName: ship-manager-backend
servicePort: http
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ship-manager-database
spec:
replicas: 1
selector:
matchLabels:
app: ship-manager-database
template:
metadata:
labels:
app: ship-manager-database
spec:
containers:
- image: mongo
name: ship-manager-database
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
ports:
- containerPort: 27017
name: mongo
env:
- name: MONGO_INITDB_ROOT_USERNAME
value: ship-manager
- name: MONGO_INITDB_ROOT_PASSWORD
value: s3cr3tp4s5
---
apiVersion: v1
kind: Service
metadata:
name: ship-manager-database
spec:
selector:
app: ship-manager-database
ports:
- port: 27017
targetPort: mongo
apiVersion: v1
kind: Secret
metadata:
name: ship-manager-database
type: Opaque
stringData:
mongo_initdb_root_username: ship-manager
mongo_initdb_root_password: s3cr3tp4s5
apiVersion: apps/v1
kind: Deployment
metadata:
name: ship-manager-backend
spec:
replicas: 1
selector:
matchLabels:
app: ship-manager-backend
template:
metadata:
labels:
app: ship-manager-backend
spec:
containers:
- image: mcr.microsoft.com/mslearn/samples/contoso-ship-manager:backend
name: ship-manager-backend
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 3000
name: http
env:
- name: DATABASE_MONGODB_URI
valueFrom:
secretKeyRef:
key: database_mongodb_uri
name: ship-manager-backend
- name: DATABASE_MONGODB_DBNAME
value: ship_manager
---
apiVersion: v1
kind: Service
metadata:
name: ship-manager-backend
spec:
selector:
app: ship-manager-backend
ports:
- name: http
port: 80
targetPort: 3000
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: ship-manager-backend
annotations:
kubernetes.io/ingress.class: addon-http-application-routing
spec:
rules:
- host: ship-manager-backend.e6a2d2a17fdc406c8f66.eastus.aksapp.io
http:
paths:
- path: /
backend:
serviceName: ship-manager-backend
servicePort: http
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ship-manager-database
spec:
replicas: 1
selector:
matchLabels:
app: ship-manager-database
template:
metadata:
labels:
app: ship-manager-database
spec:
containers:
- image: mongo
name: ship-manager-database
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
ports:
- containerPort: 27017
name: mongo
env:
- name: MONGO_INITDB_ROOT_USERNAME
valueFrom:
secretKeyRef:
name: ship-manager-database
key: mongo_initdb_root_username
- name: MONGO_INITDB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: ship-manager-database
key: mongo_initdb_root_password
---
apiVersion: v1
kind: Service
metadata:
name: ship-manager-database
spec:
selector:
app: ship-manager-database
ports:
- port: 27017
targetPort: mongo
#!/bin/bash
export STORAGE_ACCOUNT_KEY=((az storage account keys list -n cdcbackendmongodb -g cdc --query '[0].value' | tr -d '")
kubectl create secret generic azure-backend-mongodb-storage-account --from-literal=azurestorageaccountname=cdcbackendmongodb --from-literal=azurestorageaccountkey=$STORAGE_ACCOUNT_KEY
apiVersion: apps/v1
kind: Deployment
metadata:
name: ship-manager-backend
spec:
replicas: 1
selector:
matchLabels:
app: ship-manager-backend
template:
metadata:
labels:
app: ship-manager-backend
spec:
containers:
- image: mcr.microsoft.com/mslearn/samples/contoso-ship-manager:backend
name: ship-manager-backend
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 3000
name: http
env:
- name: DATABASE_MONGODB_URI
valueFrom:
secretKeyRef:
key: database_mongodb_uri
name: ship-manager-backend
- name: DATABASE_MONGODB_DBNAME
value: ship_manager
---
apiVersion: v1
kind: Service
metadata:
name: ship-manager-backend
spec:
selector:
app: ship-manager-backend
ports:
- name: http
port: 80
targetPort: 3000
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: ship-manager-backend
annotations:
kubernetes.io/ingress.class: addon-http-application-routing
spec:
rules:
- host: ship-manager-backend.e6a2d2a17fdc406c8f66.eastus.aksapp.io
http:
paths:
- path: /
backend:
serviceName: ship-manager-backend
servicePort: http
---
apiVersion: v1
kind: Secret
metadata:
name: ship-manager-backend
type: Opaque
stringData:
database_mongodb_uri: mongodb://ship-manager:[email protected]/ship-manager?authSource=admin
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ship-manager-database
spec:
replicas: 1
selector:
matchLabels:
app: ship-manager-database
template:
metadata:
labels:
app: ship-manager-database
spec:
containers:
- image: mongo
name: ship-manager-database
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
ports:
- containerPort: 27017
name: mongo
env:
- name: MONGO_INITDB_ROOT_USERNAME
valueFrom:
secretKeyRef:
name: ship-manager-database
key: mongo_initdb_root_username
- name: MONGO_INITDB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: ship-manager-database
key: mongo_initdb_root_password
---
apiVersion: v1
kind: Service
metadata:
name: ship-manager-database
spec:
selector:
app: ship-manager-database
ports:
- port: 27017
targetPort: mongo
---
apiVersion: v1
kind: Secret
metadata:
name: ship-manager-database
type: Opaque
stringData:
mongo_initdb_root_username: ship-manager
mongo_initdb_root_password: s3cr3tp4s5
apiVersion: apps/v1
kind: Deployment
metadata:
name: ship-manager-database
spec:
replicas: 1
selector:
matchLabels:
app: ship-manager-database
template:
metadata:
labels:
app: ship-manager-database
spec:
containers:
- image: mongo
name: ship-manager-database
volumeMounts:
- name: db-data
mountPath: /data/db
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
ports:
- containerPort: 27017
name: mongo
env:
- name: MONGO_INITDB_ROOT_USERNAME
valueFrom:
secretKeyRef:
name: ship-manager-database
key: mongo_initdb_root_username
- name: MONGO_INITDB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: ship-manager-database
key: mongo_initdb_root_password
volumes:
- name: db-data
emptyDir: {}
apiVersion: apps/v1
kind: Deployment
metadata:
name: ship-manager-database
spec:
replicas: 1
selector:
matchLabels:
app: ship-manager-database
template:
metadata:
labels:
app: ship-manager-database
spec:
containers:
- image: mongo
name: ship-manager-database
volumeMounts:
- name: db-data
mountPath: /data/db
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
ports:
- containerPort: 27017
name: mongo
env:
- name: MONGO_INITDB_ROOT_USERNAME
valueFrom:
secretKeyRef:
name: ship-manager-database
key: mongo_initdb_root_username
- name: MONGO_INITDB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: ship-manager-database
key: mongo_initdb_root_password
volumes:
- name: db-data
hostPath:
path: /etc/backend-db/data
type: DirectoryOrCreate
apiVersion: v1
kind: PersistentVolume
metadata:
name: azure-static-pv
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
azureFile:
shareName: static-pv
secretName: azure-backend-mongodb-storage-account
readOnly: false
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: azure-static-pvc
labels:
role: database
spec:
resources:
requests:
storage: 1Gi
accessModes:
- ReadWriteOnce
storageClassName: ""
volumeName: azure-static-pv
kind: Pod
apiVersion: v1
metadata:
name: static-pod
spec:
containers:
- name: static-pod
image: mcr.microsoft.com/oss/nginx/nginx:1.15.5-alpine
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
volumeMounts:
- mountPath: "/mnt/azure"
name: volume
volumes:
- name: volume
persistentVolumeClaim:
claimName: azure-static-pvc
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: backend-pvc
labels:
role: database
spec:
resources:
requests:
storage: 1Gi
accessModes:
- ReadWriteOnce
storageClassName: default
apiVersion: apps/v1
kind: Deployment
metadata:
name: ship-manager-backend
spec:
replicas: 1
selector:
matchLabels:
app: ship-manager-backend
template:
metadata:
labels:
app: ship-manager-backend
spec:
containers:
- image: mcr.microsoft.com/mslearn/samples/contoso-ship-manager:backend
name: ship-manager-backend
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 3000
name: http
env:
- name: DATABASE_MONGODB_URI
valueFrom:
secretKeyRef:
key: database_mongodb_uri
name: ship-manager-backend
- name: DATABASE_MONGODB_DBNAME
value: ship_manager
---
apiVersion: v1
kind: Service
metadata:
name: ship-manager-backend
spec:
selector:
app: ship-manager-backend
ports:
- name: http
port: 80
targetPort: 3000
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: ship-manager-backend
annotations:
kubernetes.io/ingress.class: addon-http-application-routing
spec:
rules:
- host: ship-manager-backend.e6a2d2a17fdc406c8f66.eastus.aksapp.io
http:
paths:
- path: /
backend:
serviceName: ship-manager-backend
servicePort: http
---
apiVersion: v1
kind: Secret
metadata:
name: ship-manager-backend
type: Opaque
stringData:
database_mongodb_uri: mongodb://ship-manager:[email protected]/ship-manager?authSource=admin
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ship-manager-database
spec:
replicas: 1
selector:
matchLabels:
app: ship-manager-database
template:
metadata:
labels:
app: ship-manager-database
spec:
containers:
- image: mongo
name: ship-manager-database
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
ports:
- containerPort: 27017
name: mongo
env:
- name: MONGO_INITDB_ROOT_USERNAME
valueFrom:
secretKeyRef:
name: ship-manager-database
key: mongo_initdb_root_username
- name: MONGO_INITDB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: ship-manager-database
key: mongo_initdb_root_password
volumeMounts:
- name: azure
mountPath: /data/db
volumes:
- name: azure
persistentVolumeClaim:
claimName: backend-pvc
---
apiVersion: v1
kind: Service
metadata:
name: ship-manager-database
spec:
selector:
app: ship-manager-database
ports:
- port: 27017
targetPort: mongo
---
apiVersion: v1
kind: Secret
metadata:
name: ship-manager-database
type: Opaque
stringData:
mongo_initdb_root_username: ship-manager
mongo_initdb_root_password: s3cr3tp4s5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment