Skip to content

Instantly share code, notes, and snippets.

@slavahatnuke
Created May 28, 2020 20:22
Show Gist options
  • Save slavahatnuke/8540b8ed2d961c81fc4648c24083a2c0 to your computer and use it in GitHub Desktop.
Save slavahatnuke/8540b8ed2d961c81fc4648c24083a2c0 to your computer and use it in GitHub Desktop.
deployment.yml
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello
spec:
replicas: 2
template:
metadata:
labels:
app: hello
spec:
containers:
- name: hello
image: slavahatnuke/node-hello-app:1.0.0
ports:
- containerPort: 3000
selector:
matchLabels:
app: hello
---
kind: Service
apiVersion: v1
metadata:
name: hello
spec:
selector:
app: hello
ports:
- protocol: "TCP"
# Port accessible inside cluster
port: 8080
# Port to forward to inside the pod
targetPort: 3000
# Port accessible outside cluster (optional)
nodePort: 30001
type: LoadBalancer
# https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: hello
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
serviceName: hello
servicePort: 8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment