zhong (钟鹏群) 2 周之前
父节点
当前提交
611824721f
共有 1 个文件被更改,包括 55 次插入0 次删除
  1. 55 0
      deployments/test-ingress.yaml

+ 55 - 0
deployments/test-ingress.yaml

@@ -0,0 +1,55 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: test-app
+  namespace: nginx-app
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: test-app
+  template:
+    metadata:
+      labels:
+        app: test-app
+    spec:
+      containers:
+      - name: test
+        image: registry.cn-hangzhou.aliyuncs.com/zhongpengqun/wanderer:linux-amd64-nginx-stable-alpine-3.23
+        ports:
+        - containerPort: 80
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: test-service
+  namespace: nginx-app
+spec:
+  selector:
+    app: test-app
+  ports:
+  - port: 80
+    targetPort: 80
+
+---
+apiVersion: networking.k8s.io/v1
+kind: Ingress
+metadata:
+  name: test-ingress
+  namespace: nginx-app
+  annotations:
+    traefik.ingress.kubernetes.io/service.prefer-service-port: "true"
+spec:
+  ingressClassName: traefik
+  rules:
+  - host: test.9981.tech   # 随便用个子域名
+    http:
+      paths:
+      - path: /
+        pathType: Prefix
+        backend:
+          service:
+            name: test-service
+            port:
+              number: 80