背景
- 集群内部web图片存储在外部的minio场景
例如: 将 bbs.xxxx.com/it-project-… 引用到: minio.xxxx.com:9000
创建外部svc + Endpoints
- 创建Endpoints
< namespace > 替换为对应的namespace
cat << EOF | kubectl apply -f - -n <namespace>
apiVersion: v1
kind: Endpoints
metadata:
name: minio-proxy
subsets:
- addresses:
- ip: xxx.xxx.xxx.xxx
ports:
- port: 9000
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
labels:
app: minio-proxy
name: minio-proxy
spec:
ports:
- port: 9000
targetPort: 9000
protocol: TCP
sessionAffinity: None
type: ClusterIP
EOF
- 者创建外部ExternalName
cat << EOF | kubectl apply -f - -n <namespace>
kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: bbs-minio
annotations:
nginx.ingress.kubernetes.io/backend-protocol: HTTPS //后端如果是https
spec:
tls:
- hosts:
- bbs.xxxx.com
secretName: xxxx-com
rules:
- host: bbs.xxxx.com
http:
paths:
- path: /it-project-bpm/2022/11/22
pathType: ImplementationSpecific
backend:
service:
name: minio-proxy
port:
number: 9000
EOF
创建对应转发的ingress
< namespace > 替换为对应的namespace
cat << EOF | kubectl apply -f - -n <namespace>
kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: bbs-minio
annotations:
nginx.ingress.kubernetes.io/backend-protocol: HTTPS //后端如果是https
spec:
tls:
- hosts:
- bbs.xxxx.com
secretName: xxxx-com
rules:
- host: bbs.xxxx.com
http:
paths:
- path: /it-project-bpm/2022/11/22
pathType: ImplementationSpecific
backend:
service:
name: minio-proxy
port:
number: 9000
EOF