Created
January 29, 2021 21:32
-
-
Save boxcee/337ee51a77df2e7de666f0b523324831 to your computer and use it in GitHub Desktop.
kubernetes/express
This file contains hidden or 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: v1 | |
kind: ConfigMap | |
metadata: | |
name: express | |
data: | |
index.js: | | |
const express = require('express') | |
const app = express(); | |
const port = 3000; | |
app.get('/', (req, res) => { | |
res.send('Hello World! You too!') | |
}); | |
app.listen(port, () => { | |
console.log(`Example app listening at http://localhost:${port}`) | |
}); | |
--- | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: express | |
labels: | |
app: express | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: express | |
template: | |
metadata: | |
labels: | |
app: express | |
spec: | |
restartPolicy: Always | |
initContainers: | |
- name: init | |
image: node:lts | |
volumeMounts: | |
- mountPath: /app | |
name: memory | |
workingDir: /app | |
args: | |
- npm | |
- install | |
- --save | |
- express | |
containers: | |
- name: express | |
image: node:lts | |
imagePullPolicy: IfNotPresent | |
volumeMounts: | |
- mountPath: /app | |
name: memory | |
- mountPath: /app/index.js | |
subPath: index.js | |
name: express | |
workingDir: /app | |
args: | |
- index.js | |
ports: | |
- containerPort: 3000 | |
name: development | |
volumes: | |
- name: express | |
configMap: | |
defaultMode: 0722 | |
name: express | |
- name: memory | |
emptyDir: | |
medium: Memory | |
sizeLimit: 256Mi | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: express | |
spec: | |
selector: | |
app: express | |
ports: | |
- port: 80 | |
protocol: TCP | |
targetPort: development | |
name: http | |
--- | |
apiVersion: networking.k8s.io/v1beta1 | |
kind: Ingress | |
metadata: | |
name: express | |
annotations: | |
cert-manager.io/cluster-issuer: cert-manager-cluster-issuer | |
kubernetes.io/ingress.class: nginx | |
spec: | |
rules: | |
- host: express.com | |
http: | |
paths: | |
- backend: | |
serviceName: express | |
servicePort: http | |
path: / | |
tls: | |
- hosts: | |
- express.com | |
secretName: express.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment