一个nginx 配置 静态文件的例子

apiVersion: v1
kind: ConfigMap
metadata:
  name: well-known-file
  namespace: ma
data:
  apple-developer-merchantid-domain-association: |
    109 97 108 101 109 97 46 110 101 116 这边是你自己完整的内容
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: static-file-nginx
  namespace: ma
spec:
  replicas: 1
  selector:
    matchLabels:
      app: static-file-nginx
  template:
    metadata:
      labels:
        app: static-file-nginx
    spec:
      containers:
      - name: nginx
        image: nginx:latest
        volumeMounts:
        - name: well-known-file
          mountPath: /usr/share/nginx/html/.well-known/
        resources:
          requests:
            memory: 50Mi
            cpu: 5m 
          limits:
            memory: 200Mi
            cpu: 50m
      volumes:
      - name: well-known-file
        configMap:
          name: well-known-file
---

apiVersion: v1
kind: Service
metadata:
    name: static-file-nginx
    namespace: ma
spec:
    ports:
    - port: 80 
    selector:
        app: static-file-nginx    

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: static-file
  namespace: ma
spec:
  ingressClassName: nginx
  tls:
    - hosts:
      - xxx.xxx.com
      secretName: ma-ingress-tls
  rules:
  - host: xxx.xxx.com
    http:
      paths:
      - pathType: Prefix
        path: /.well-known/
        backend:
          service:
            name: static-file-nginx
            port:
              number: 80
上一篇:Configmap
最近更新的
...