k8s集群下网络请求一般流程
1. k8s集群网络请求流程2. 部署文件yml示例
·
请求流程示意图
yml示例文件
apiVersion: apps/v1
kind: Deployment
metadata:
name: docker-demo
namespace: nero
spec:
selector:
matchLabels:
app: docker-demo
replicas: 1 # tells deployment to run 4 pods matching the template
template: # create pods using pod definition in this template
metadata:
labels:
app: docker-demo
spec:
containers:
- name: docker-demo
image: registry.cn-hangzhou.aliyuncs.com/zhangnero/docker-demo:v1.0
imagePullPolicy: Always
ports:
- containerPort: 8080
name: server
imagePullSecrets:
- name: aliyun-account
---
kind: Service
apiVersion: v1
metadata:
name: docker-demo
namespace: nero
spec:
selector:
app: docker-demo
ports:
- protocol: TCP
port: 8080
targetPort: 8080
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: docker-demo
namespace: nero
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/proxy-body-size: "100m"
nginx.ingress.kubernetes.io/force-ssl-redirect: "false"
nginx.ingress.kubernetes.io/proxy-read-timeout: "100s"
spec:
rules:
- host: www.nero.com
http:
paths:
- path: /*
backend:
serviceName: docker-demo
servicePort: 8080
更多推荐
已为社区贡献1条内容
所有评论(0)