To connect your services to the control plane, you need one or more data planes. To create a data plane on Universal, you need to create a data plane definition and pass it to the kuma-dp run command.
On Universal, data planes need to start with a token for authentication. To learn how to generate tokens, see the data plane authentication docs.
When transparent proxying isn’t enabled, the outbound service dependencies have to be manually specified in the Dataplane entity.
This also means that without transparent proxying, you must update your codebases to consume those external services on 127.0.0.1, on the port specified in the outbound section.
To avoid users bypassing the proxy, have the service listen only on the internal interface (
127.0.0.1or::1) instead of all interfaces (0.0.0.0or::).
For example, here’s how to start a Dataplane for a Redis service, and then start the kuma-dp process:
cat dp.yaml
type: Dataplane
mesh: default
name: redis-1
networking:
address: 23.234.0.1 # IP of the instance
inbound:
- port: 9000
servicePort: 6379
tags:
kuma.io/service: redis
kuma-dp run \
--cp-address=https://127.0.0.1:5678 \
--dataplane-file=dp.yaml
--dataplane-token-file=/tmp/kuma-dp-redis-1-token
In the example above, any external client who wants to consume Redis through the sidecar will have to use 23.234.0.1:9000, which will redirect to the Redis service listening on address 127.0.0.1:6379. If your service doesn’t listen on 127.0.0.1 and you can’t change the address it listens on, you can set the serviceAddress:
type: Dataplane
...
networking:
...
inbound:
- port: 9000
serviceAddress: 192.168.1.10
servicePort: 6379
...
This configuration indicates that your service is listening on 192.168.1.10, and incoming traffic will be redirected to that address.
Now let’s assume that we have another service called “Backend” that listens on port 80, and that makes outgoing requests to the redis service:
cat dp.yaml
type: Dataplane
mesh: default
name:
networking:
address:
inbound:
- port: 8000
servicePort: 80
tags:
kuma.io/service: backend
kuma.io/protocol: http
outbound:
- port: 10000
tags:
kuma.io/service: redis
kuma-dp run \
--cp-address=https://127.0.0.1:5678 \
--dataplane-file=dp.yaml \
--dataplane-var name=`hostname -s` \
--dataplane-var address=192.168.0.2 \
--dataplane-token-file=/tmp/kuma-dp-backend-1-token
For the backend service to successfully consume redis, you must specify an outbound networking section in the Dataplane configuration instructing the data plane to listen on a new port 10000 and to proxy any outgoing requests on port 10000 to the redis service.
For this to work, you must update your application to consume redis on 127.0.0.1:10000.
You can parametrize your
Dataplanedefinition to reuse the same file for manykuma-dpinstances or even services.