apiVersion: v1
kind: Namespace
metadata:
  name: echoserver
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: echoserver
  namespace: echoserver
spec:
  replicas: 5
  selector:
    matchLabels:
      app: echoserver
  template:
    metadata:
      labels:
        app: echoserver
    spec:
      containers:
      - image: registry.cn-shenzhen.aliyuncs.com/shuhui/echoserver:2.2-linux-arm64
      #- image: registry.cn-shenzhen.aliyuncs.com/shuhui/echoserver:1.10.3
        imagePullPolicy: IfNotPresent
        name: echoserver
        ports:
        - containerPort: 8080
        env:
        - name: PORT
          value: "8080"
---
apiVersion: v1
kind: Service
metadata:
  name: echoserver
  namespace: echoserver
spec:
  ports:
    - port: 80
      targetPort: 8080
      protocol: TCP
  type: ClusterIP
  selector:
    app: echoserver
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: echoserver
  namespace: echoserver
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
  - http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: echoserver
            port:
              number: 80

---
# Istio
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  name: echoserver
  namespace: echoserver
spec:
  gateways:
  - vqiu-gateway
  hosts:
  - "*"
  http:
  - match:
    - uri:
       prefix: /
    route:
    - destination:
        host: echoserver.echoserver.svc.cluster.local
        port:
          number: 80
