Ingress 实战
创建 Deployment
deploy-web.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
labels:
app: nginx
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
imagePullPolicy: IfNotPresent
ports:
- containerPort: 80
name: web创建
修改 html 以区分(可选)
创建 Service
svc-ng.yaml
创建
创建 Ingress
ingress-web.yaml
命令行创建(可选)
访问
方式一:临时映射
方式二:NodePort
Last updated