Configure access to the service via TCP protocol
Configure access to the service via TCP protocol
Object Ingress Kubernetes by default supports routing external traffic to services only via HTTP(s). To access a service in a Managed Kubernetes cluster over TCP, you must configure access through the Ingress Controller.
TCP access may be required, for example, when deploying a database, cache server, or other services that run over TCP.
We will look at configuring access through the Nginx Ingress Controller.
Create ConfigMap
-
Create a yaml file with a manifest for the object ConfigMap:
Manifesto example:
apiVersion: v1
kind: ConfigMap
metadata:
name: tcp-services
namespace: ingress-nginx
data:
<external_port>: "<namespace>/<service_name>:<service_port>"Specify:
<external_port>
— external port to access the service;<namespace>
— The namespace in which the service resides;<service_name>
— the name of the service for which you are configuring TCP access;<service_port>
— port of service.
-
Create ConfigMap:
kubectl apply -f <configmap.yaml>
Specify
<configmap.yaml>
— name of the yaml file with the manifest for ConfigMap that you created in step 1.
To configure the Ingress Controller
In arguments. Ingress Controller add a flag --tcp-services-configmap
:
args:
- /nginx-ingress-controller
- --tcp-services-configmap=ingress-nginx/tcp-services