# TCPIngress how can I use it?

**URL:** <https://discuss.konghq.com/t/tcpingress-how-can-i-use-it/5908>\
**Category:** General\
**Tags:** kubernetes, kong-gateway\
**Created:** [March 31, 2020, 10:29am UTC](https://discuss.konghq.com/t/tcpingress-how-can-i-use-it/5908 "2020-03-31T10:29:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ori](https://avatars.discourse-cdn.com/v4/letter/o/ecae2f/32.png) [@ori](https://discuss.konghq.com/u/ori)\
**Post date:** [March 31, 2020, 10:29am UTC](https://discuss.konghq.com/t/tcpingress-how-can-i-use-it/5908/1 "2020-03-31T10:29:08Z")

</div>

Hi,

I’m a little bit new with Kong and I saw that on Kong for Kubernetes 0.8 there is support for TCPIngress.  
I saw that code:  
apiVersion: [configuration.konghq.com/v1beta1](http://configuration.konghq.com/v1beta1)  
kind: TCPIngress  
metadata:  
name: sample-tcp  
spec:  
rules:  
- port: 9000  
backend:  
serviceName: config-db  
servicePort: 2701

but how can I attach it to the relevant ingress?  
Can someone give me an example?

> **[Kong for Kubernetes 0.8 Released!](https://konghq.com/blog/product-releases/kong-for-kubernetes-0-8-released)**
>
> Est. reading time: 5 min read

Thanks,  
Ori.

---

<div class="post-metadata">

**Author:** ![hbagdi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hbagdi/32/562_2.png) [@hbagdi](https://discuss.konghq.com/u/hbagdi)\
**Post date:** [March 31, 2020, 9:37pm UTC](https://discuss.konghq.com/t/tcpingress-how-can-i-use-it/5908/2 "2020-03-31T21:37:15Z")

</div>

Please refer to the guide on this topic: [https://github.com/Kong/kubernetes-ingress-controller/blob/master/docs/guides/using-tcpingress.md](https://github.com/Kong/kubernetes-ingress-controller/blob/master/docs/guides/using-tcpingress.md)

---

<div class="post-metadata">

**Author:** ![ori](https://avatars.discourse-cdn.com/v4/letter/o/ecae2f/32.png) [@ori](https://discuss.konghq.com/u/ori)\
**Post date:** [March 31, 2020, 9:52pm UTC](https://discuss.konghq.com/t/tcpingress-how-can-i-use-it/5908/3 "2020-03-31T21:52:54Z")

</div>

Amazing ! thanks ! will try it first thing tomorrow morning !  
last question - how can I load my certificate ?

can I add to the TCPIngress  
tls:

- hosts:
  - [example.com](http://example.com)  
secretName: example-certificate

?

---

<div class="post-metadata">

**Author:** ![ori](https://avatars.discourse-cdn.com/v4/letter/o/ecae2f/32.png) [@ori](https://discuss.konghq.com/u/ori)\
**Post date:** [April 6, 2020, 6:56am UTC](https://discuss.konghq.com/t/tcpingress-how-can-i-use-it/5908/4 "2020-04-06T06:56:06Z")

</div>

Hi Hbagdi, how can I replace Kong’s default certificate?

---

<div class="post-metadata">

**Author:** ![hbagdi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hbagdi/32/562_2.png) [@hbagdi](https://discuss.konghq.com/u/hbagdi)\
**Post date:** [April 7, 2020, 4:52am UTC](https://discuss.konghq.com/t/tcpingress-how-can-i-use-it/5908/5 "2020-04-07T04:52:20Z")

</div>

You can use `tls` section, similar to how you can do it in Ingress resource. This documentation is currently missing.

The `tls` section of TCPIngress and Ingress resource is exactly same.

---

<div class="post-metadata">

**Author:** ![ori](https://avatars.discourse-cdn.com/v4/letter/o/ecae2f/32.png) [@ori](https://discuss.konghq.com/u/ori)\
**Post date:** [April 7, 2020, 8:08pm UTC](https://discuss.konghq.com/t/tcpingress-how-can-i-use-it/5908/6 "2020-04-07T20:08:12Z")

</div>

it seems like something is broken on my side… I will try again…  
how can I replace the localhost certificate to be my valid tls certificate ? (the default certificate)

---

<div class="post-metadata">

**Author:** ![hbagdi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hbagdi/32/562_2.png) [@hbagdi](https://discuss.konghq.com/u/hbagdi)\
**Post date:** [April 8, 2020, 12:32am UTC](https://discuss.konghq.com/t/tcpingress-how-can-i-use-it/5908/7 "2020-04-08T00:32:23Z")

</div>

> [@ori](#):
>
> how can I replace the localhost certificate to be my valid tls certificate ? (the default certificate)

As I said before, using the `TLS` section:

> **[Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/#tls)**
>
> Make your HTTP (or HTTPS) network service available using a protocol-aware configuration mechanism, that understands web concepts like URIs, hostnames, paths, and more. The Ingress concept lets you map traffic to different backends based on rules you...

---

<div class="post-metadata">

**Author:** ![Kristoffer\_Johansson](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/kristoffer_johansson/32/2116_2.png) [@Kristoffer\_Johansson](https://discuss.konghq.com/u/Kristoffer_Johansson)\
**Post date:** [November 17, 2020, 1:07pm UTC](https://discuss.konghq.com/t/tcpingress-how-can-i-use-it/5908/8 "2020-11-17T13:07:37Z")

</div>

I have Kong running in K8S , KONG\_STREAM\_LISTEN is set to “0.0.0.0:9000, 0.0.0.0:9443”, I have a separate k8s service which is used for TCP traffic which use an AWS NLB.

In the cluster I use cert-manager for creating certificates. I’ve created a certificate which I use in the TCPIngress tls section.

But when I try to connect with openssl to check if the certificate is returned I can’t see that it is.  
This is the response I get (except for the written packet which is not pasted)

```auto
read from 0x55e8e1d6d2e0 [0x55e8e1d87883] (5 bytes => 0 (0x0))
write:errno=0
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 338 bytes
Verification: OK
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)
---
read from 0x55e8e1d6d2e0 [0x55e8e1caf160] (8192 bytes => 0 (0x0))

```

Any idea why Kong isn’t returning the cert?

EDIT: I noticed I hadn’t defined the TLS port as ‘ssl’ in KONG\_STREAM\_LISTEN, after doing that it worked.
