Skip to content

Instantly share code, notes, and snippets.

@duan-li
Last active March 30, 2022 12:12
Show Gist options
  • Save duan-li/6f7f53c43c3d4c6910445abebccf9a6e to your computer and use it in GitHub Desktop.
Save duan-li/6f7f53c43c3d4c6910445abebccf9a6e to your computer and use it in GitHub Desktop.
minikube local dev ingress example
# ref https://k8s.io/examples/service/networking/example-ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: local-dev-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
rules:
- host: dev.test
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: web
port:
number: 8080
# kubectl create deployment web --image=gcr.io/google-samples/hello-app:1.0 --dry-run=client
-o yaml
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: web
name: web
spec:
replicas: 1
selector:
matchLabels:
app: web
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
app: web
spec:
containers:
- image: gcr.io/google-samples/hello-app:1.0
name: hello-app
resources: {}
status: {}
# kubectl expose deployment web --type=NodePort --port=8080 --dry-run=client -o yaml
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
app: web
name: web
spec:
ports:
- port: 8080
protocol: TCP
targetPort: 8080
selector:
app: web
type: NodePort
status:
loadBalancer: {}