Ingress อยู่ใน namespace twgis ใช้ TLS secret twgis-tls. IP จริงของผู้ใช้อยู่ใน header X-Forwarded-For (ไม่ใช่ remote_addr) เพราะ edge ใช้ PROXY protocol. ⚠️ image ต้องเป็น arm64 (cluster เป็น Apple Silicon; amd64 อย่างเดียวจะ exec format error).
apiVersion: apps/v1
kind: Deployment
metadata: { name: myapp, namespace: twgis }
spec:
replicas: 2
selector: { matchLabels: { app: myapp } }
template:
metadata: { labels: { app: myapp } }
spec:
containers:
- name: app
image: your-image:tag
ports: [{ containerPort: 8080 }]
---
apiVersion: v1
kind: Service
metadata: { name: myapp, namespace: twgis }
spec:
selector: { app: myapp }
ports: [{ port: 80, targetPort: 8080 }]
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata: { name: myapp, namespace: twgis }
spec:
ingressClassName: nginx
tls: [{ hosts: ["twgis.mapboss.co.th"], secretName: twgis-tls }]
rules:
- host: twgis.mapboss.co.th
http: { paths: [{ path: /, pathType: Prefix,
backend: { service: { name: myapp, port: { number: 80 } } } }] }
ใช้ port ในช่วง 33020-33039 บน IP 192.168.64.221. หลาย service ใช้ IP เดียวกันได้ผ่าน allow-shared-ip คนละ port — apply แล้วเข้าถึงได้เลย. ถ้าต้องการ port นอกช่วงนี้ ติดต่อทีม platform.
apiVersion: v1
kind: Service
metadata:
name: myapp-tcp
namespace: twgis
annotations:
metallb.universe.tf/loadBalancerIPs: "192.168.64.221"
metallb.universe.tf/allow-shared-ip: "twgis"
spec:
type: LoadBalancer
selector: { app: myapp }
ports: [{ port: 33020, targetPort: 6379 }]
ต้องการ persistent volume → ใช้ storageClassName: nfs-tb
apiVersion: v1
kind: PersistentVolumeClaim
metadata: { name: data, namespace: twgis }
spec:
accessModes: [ReadWriteOnce]
storageClassName: nfs-tb
resources: { requests: { storage: 5Gi } }
kubeconfig ทีม platform ส่งให้แยกต่างหาก (มี token ไม่หมดอายุ — เก็บเป็นความลับ). Default namespace: twgis.