惜风不起、唯有努力!
traefik2.0+   ingressroute语法damo

traefik2.0+ ingressroute语法damo

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx02-dep
  #namespace: web
  labels:
    app: nginx02
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx02
  template:
    metadata:
      labels:
        app: nginx02
    spec:
      terminationGracePeriodSeconds: 40
#      serviceAccountName: web-nginx-sa
      containers:
      - name: nginx02
        image: nginx:1.16
        imagePullPolicy: IfNotPresent
        env:
        - name: DEMO_GREETING
          value: "my-env"
        ports:
        - containerPort: 80
          name: app-port
          protocol: TCP
        resources:
          limits:
            cpu: 200m
            memory: 500Mi
          requests:
            cpu: 100m
            memory: 200Mi

---
apiVersion: v1
kind: Service
metadata:
  name: nginx02
#  namespace: web
  labels:
    app: nginx02
spec:
 # externalTrafficPolicy: Local
  selector:
    app: nginx02
  #type: NodePort
  ports:
  - name: web
    port: 80
    targetPort: app-port
   # nodePort: 30100

---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: nginx02-ingtr
spec:
  entryPoints:
    - web
  routes:
    - match: Host(`nginx02.web`)
      kind: Rule
      services:
        - name: nginx02
          port: 80

发表回复

您的电子邮箱地址不会被公开。