amazon-web-serviceskubernetesdevopskubernetes-ingressambassador

How can I use Ambassador Emissary -ingress for TLS?


I have a really quick question. To clarify something I have to share with you my postman result.

enter image description here

I am using 2 articles to be successful for that:

https://www.getambassador.io/docs/emissary/pre-release/topics/install/

https://www.getambassador.io/docs/emissary/pre-release/howtos/tls-termination/

I am trying to add TLS for my Ambassador Ingress. Everything looks good. Please look below

enter image description here

But When I am sending a request over https (look above postman) it returns to me error : "Error: Client network socket disconnected before secure TLS connection was established"

My deployment.yaml will be usefull for solving my issue:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: echo-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: echo-server
  template:
    metadata:
      labels:
        app: echo-server
    spec:
      containers:
        - name: echo-server
          image: jmalloc/echo-server
          ports:
            - name: http-port
              containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: echo-service
spec:
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: 8080
  - name: https
    port: 443
    protocol: TCP
    targetPort: 8443
  selector:
    app: echo-server
    
---
apiVersion: x.getambassador.io/v3alpha1
kind: AmbassadorMapping
metadata:
  name: echo-backend
  namespace: default
spec:
  hostname: "*"
  prefix: /echo/
  service: echo-service

---
apiVersion: x.getambassador.io/v3alpha1
kind: AmbassadorListener
metadata:
  name: emissary-ingress-listener-8080
  namespace: emissary
spec:
  port: 8080
  protocol: HTTPPROXY
  securityModel: XFP
  hostBinding:
    namespace:
      from: ALL

---
apiVersion: x.getambassador.io/v3alpha1
kind: AmbassadorHost
metadata:
  name: wildcard-host
spec:
  hostname: "*"
  acmeProvider:
    authority: none
  tlsSecret:
    name: tls-cert
  selector:
    matchLabels:
      hostname: wildcard-host


also I am using curl to be sure
```C
curl -Lk https://143.198.247.222/echo/
{
    "server": "trim-kumquat-fccjxh8x",
    "quote": "Abstraction is ever present.",
    "time": "2019-07-24T16:36:56.7983516Z"
}

Solution

  • Emissary and Edge Stack actually handle TLS identically – given that curl works, I'm inclined to think that what you're seeing here is that you're following the directions to get a self-signed TLS certificate, and Postman is simply being stricter about certificates than curl is.

    If you drop the -k from curl, I would expect it to fail too. Likewise, if you're doing HTTPS from a browser, most browsers are very picky about proper certificates. So I'd recommend that you start by getting a properly-signed certificate (perhaps from Let's Encrypt?), and try that.