Disclaimer:
Due to a non-disclosure agreement (NDA), the details in this post have been modified and are based on a hypothetical example for illustrative purposes. The core issue, however, remains representative of the actual challenge.
Scenario:
- Two VPCs are configured:
VPC-public
andVPC-private
. Note: These public, private are just names for our convinence. - Two EC2 instances are present:
EC2-public
inVPC-public
.EC2-private
inVPC-private
.
- An EKS cluster is set up in
VPC-private
.
I have also posted a simple diagram to understand the architecture
The following OpenZiti components have been deployed:
Ziti Controller
The controller was deployed with the following values.yml
configuration:
clientApi:
advertisedHost: ziti-controller.example.com
service:
enabled: true
type: ClusterIP
ingress:
enabled: true
ingressClassName: "nginx"
annotations:
kubernetes.io/ingress.allow-http: "false"
nginx.ingress.kubernetes.io/ssl-passthrough: "true"
external-dns.alpha.kubernetes.io/hostname: "ziti-controller.example.com"
service.beta.kubernetes.io/aws-load-balancer-internal: "false" # Ensures the LB is public
ctrlPlane:
containerPort: "{{ .Values.clientApi.containerPort }}"
advertisedHost: "{{ .Values.clientApi.advertisedHost }}"
advertisedPort: "{{ .Values.clientApi.advertisedPort }}"
service:
enabled: true
type: ClusterIP
highAvailability:
# -- Ziti controller HA mode
mode: standalone
# -- Ziti controller HA swarm replicas
replicas: 1
persistence:
enabled: true
storageClass: "ebs-sc"
accessMode: ReadWriteOnce
size: 3Gi
cert-manager:
enabled: true
enableCertificateOwnerRef: true
installCRDs: false
trust-manager:
enabled: true
app:
trust:
namespace: "ziti-controller"
crds:
enabled: false
ingress-nginx:
enabled: true
controller:
extraArgs:
enable-ssl-passthrough: "true"
service:
annotations:
service.beta.kubernetes.io/aws-load-balancer-internal: "false"
Ziti Routers
Two routers were set up:
-
Router-Private:
ctrl: endpoint: ziti-controller.example.com:443 advertisedHost: ziti-router-private.example.com # Edge configuration for external identities edge: advertisedHost: ziti-router-private.example.com advertisedPort: 443 service: type: LoadBalancer annotations: external-dns.alpha.kubernetes.io/hostname: ziti-router-private.example.com service.beta.kubernetes.io/aws-load-balancer-internal: "true" # loadbalancer here is private ingress: enabled: false # Link listeners for router-to-router communication (internal) linkListeners: transport: advertisedHost: ziti-router-transport-private.example.com advertisedPort: 443 service: enabled: true type: ClusterIP # All routers are internal; no external exposure ingress: enabled: false # Not needed as routers are internal # Persistence for router data persistence: enabled: true accessMode: ReadWriteOnce size: 1Gi storageClass: ebs-sc
-
Router-Public:
ctrl: endpoint: ziti-controller.example.com:443 advertisedHost: ziti-router-public.example.com # Edge configuration for external identities edge: advertisedHost: ziti-router-public.example.com advertisedPort: 443 service: type: LoadBalancer annotations: external-dns.alpha.kubernetes.io/hostname: ziti-router-public.example.com service.beta.kubernetes.io/aws-load-balancer-internal: "false" # Loadbalancer here is public ingress: enabled: false # Link listeners for router-to-router communication (internal) linkListeners: transport: advertisedHost: ziti-router-transport-public.example.com advertisedPort: 443 service: enabled: true type: ClusterIP # All routers are internal; no external exposure ingress: enabled: false # Not needed as routers are internal # Persistence for router data persistence: enabled: true accessMode: ReadWriteOnce size: 1Gi storageClass: ebs-sc
The routers were installed using Helm with enrollment JWTs:
helm install ziti-router-private-release \
--namespace ziti-router --create-namespace \
openziti/ziti-router \
--set-file enrollmentJwt=router-private.jwt \
--values router-values-private.yml
helm install ziti-router-public-release \
--namespace ziti-router --create-namespace \
openziti/ziti-router \
--set-file enrollmentJwt=router-public.jwt \
--values router-values-public.yml
Ziti Edge Tunnel Configuration
-
The identity for
EC2-public
was created, enrolled, and the Ziti tunnel was started:ziti edge create identity device EC2-public --role-attributes "EC2-public" -o EC2-public.jwt ziti edge enroll EC2-public.jwt -o EC2-public.json
-
The identity for
EC2-private
was created, enrolled, and the Ziti tunnel was started:ziti edge create identity device EC2-private --role-attributes "EC2-private" -o EC2-private.jwt ziti edge enroll EC2-private.jwt -o EC2-private.json
-
Edge router policies were created to bind each EC2 instance to its respective router:
ziti edge create edge-router-policy router-private-router-policy \ --edge-router-roles "#router-private" \ --identity-roles "#EC2-private" \ --semantic "AllOf" ziti edge create edge-router-policy router-public-router-policy \ --edge-router-roles "#router-public" \ --identity-roles "#EC2-public" \ --semantic "AllOf"
Our Task
So in EC2-public
we have a application which is accessed on TCP:80. We want to access that application from EC2-private
. For testing we have installed apache2 where we can just run the curl command to test.
So to achieve this what I ran the below commands:
Intercept Configuration
ziti edge create config apache-intercept-ip intercept.v1 '{
"protocols": ["tcp"],
"addresses": ["10.100.99.99"],
"portRanges": [{"low": 80, "high": 80}]
}'
Host Configuration
ziti edge create config apache-host.v1 host.v1 '{
"protocol": "tcp",
"address": "127.0.0.1",
"port": 80
}'
Create the Service
ziti edge create service apache-service --configs apache-intercept-ip,apache-host.v1
Create Service Policies
-
Dial Policy: Allow
EC2-private
to access the service:ziti edge create service-policy apache-dial-policy Dial --service-roles "@apache-service" --identity-roles "#EC2-private"
-
Bind Policy: Allow
EC2-public
to host the service:ziti edge create service-policy apache-bind-policy Bind --service-roles "@apache-service" --identity-roles "#EC2-public"
Connecting the tunnels:
ziti-edge-tunnel run -i EC2-public.json
ziti-edge-tunnel run -i EC2-private.json
Now both the tunnels get connected, technically I have to run curl http://10.100.99.99 to test the connection here. But it is not connecting.
After checking the tunnels logs I have found that there is some issue in the EC2-public
Logs and Outputs
-
ziti-edge-tunnel
logs from EC2-public:About to run tunnel service... ziti-edge-tunnel (7088)[ 0.000] INFO ziti-sdk:utils.c:198 ziti_log_set_level() set log level: root=3/INFO (7088)[ 0.000] INFO ziti-sdk:utils.c:167 ziti_log_init() Ziti C SDK version 1.2.1 @g9db50a3(HEAD) starting at (2024-12-27T23:55:31.751) (7088)[ 0.000] INFO tunnel-sdk:ziti_tunnel.c:60 create_tunneler_ctx() Ziti Tunneler SDK (v1.2.10-beta14) (7088)[ 0.000] INFO tunnel-cbs:ziti_dns.c:173 seed_dns() DNS configured with range 100.64.0.0 - 100.127.255.255 (4194302 ips) (7088)[ 0.000] INFO ziti-edge-tunnel:ziti-edge-tunnel.c:1022 make_socket_path() effective group set to 'ziti' (gid=988) (7088)[ 0.011] INFO ziti-edge-tunnel:resolvers.c:68 init_libsystemd() Initializing libsystemd (7088)[ 0.011] WARN ziti-edge-tunnel:instance.c:39 find_tunnel_identity() Identity ztx[EC2-public.json] is not loaded yet or already removed. (7088)[ 0.011] INFO tunnel-cbs:ziti_tunnel_ctrl.c:1135 load_ziti_async() attempting to load ziti instance[EC2-public.json] (7088)[ 0.011] INFO tunnel-cbs:ziti_tunnel_ctrl.c:1142 load_ziti_async() loading ziti instance[EC2-public.json] (7088)[ 0.011] INFO ziti-edge-tunnel:ziti-edge-tunnel.c:425 load_id_cb() identity[EC2-public.json] loaded (7088)[ 0.012] INFO ziti-sdk:ziti.c:425 ziti_start_internal() ztx[0] enabling Ziti Context (7088)[ 0.012] INFO ziti-sdk:ziti.c:442 ziti_start_internal() ztx[0] using tlsuv[v0.32.8/OpenSSL 3.3.1 4 Jun 2024] (7088)[ 0.012] INFO ziti-sdk:ziti_ctrl.c:604 ziti_ctrl_init() ctrl[(null):] using https://ziti-controller.example.com:443/edge/client/v1 (7088)[ 0.012] INFO ziti-sdk:ziti.c:512 ztx_init_controller() ztx[0] Loading ziti context with controller[https://ziti-controller.example.com:443/edge/client/v1] (7088)[ 0.072] INFO ziti-sdk:ziti.c:1778 version_pre_auth_cb() ztx[0] connected to Legacy controller https://ziti-controller.example.com:443/edge/client/v1 version v1.1.15(0eec47ce3c80 2024-10-02T12:59:41Z) (7088)[ 0.097] INFO ziti-edge-tunnel:ziti-edge-tunnel.c:798 on_event() ztx[EC2-public.json] API Event with controller address : (null) (7088)[ 0.100] ERROR tunnel-cbs:ziti_tunnel_ctrl.c:1571 update_config_done() updated config file with new URL (7088)[ 0.102] INFO tunnel-cbs:ziti_tunnel_ctrl.c:981 on_ziti_event() ziti_ctx[EC2-public] connected to controller (7088)[ 0.102] INFO ziti-edge-tunnel:ziti-edge-tunnel.c:463 on_event() ztx[EC2-public.json] context event : status is OK (7088)[ 0.130] INFO ziti-sdk:channel.c:272 new_ziti_channel() ch[0] (router-public) new channel for ztx[0] identity[EC2-public] (7088)[ 0.130] INFO tunnel-cbs:ziti_tunnel_ctrl.c:1052 on_ziti_event() ztx[EC2-public] added edge router router-public@ziti-router-public.example.com (7088)[ 0.130] INFO ziti-sdk:channel.c:801 reconnect_channel() ch[0] reconnecting NOW (7088)[ 0.212] INFO tunnel-cbs:ziti_tunnel_ctrl.c:953 on_service() hosting server_address[tcp:127.0.0.1:80] service[apache-service] (7088)[ 0.212] INFO ziti-edge-tunnel:ziti-edge-tunnel.c:611 on_event() =============== service event (added) - apache-service:1Yq8uc7EIO0FYT6dD2311q =============== (7088)[ 0.212] INFO ziti-edge-tunnel:tun.c:196 tun_commit_routes() starting 1 route updates (7088)[ 0.216] INFO ziti-edge-tunnel:tun.c:118 route_updates_done() route updates[1]: 0/OK (7088)[ 0.218] WARN ziti-sdk:bind.c:246 session_cb() server[0.0](apache-service) failed to get session for service[apache-service]: -17/NO_EDGE_ROUTERS_AVAILABLE (7088)[ 0.239] INFO ziti-sdk:channel.c:699 hello_reply_cb() ch[0] connected. EdgeRouter version: v1.1.15|0eec47ce3c80|2024-10-02T12:59:41Z|linux|amd64 (7088)[ 0.239] INFO tunnel-cbs:ziti_tunnel_ctrl.c:1056 on_ziti_event() ztx[EC2-public] router router-public connected (7088)[ 0.239] INFO ziti-edge-tunnel:resolvers.c:402 try_libsystemd_resolver() systemd-resolved selected as DNS resolver manager (7088)[ 1.096] INFO ziti-sdk:posture.c:206 ziti_send_posture_data() ztx[0] first run or potential controller restart detected (7088)[ 2.130] WARN ziti-sdk:bind.c:246 session_cb() server[0.0](apache-service) failed to get session for service[apache-service]: -17/NO_EDGE_ROUTERS_AVAILABLE (7088)[ 3.374] WARN ziti-sdk:bind.c:246 session_cb() server[0.0](apache-service) failed to get session for service[apache-service]: -17/NO_EDGE_ROUTERS_AVAILABLE (7088)[ 7.639] WARN ziti-sdk:bind.c:246 session_cb() server[0.0](apache-service) failed to get session for service[apache-service]: -17/NO_EDGE_ROUTERS_AVAILABLE
-
ziti-edge-tunnel
logs from EC2-private:About to run tunnel service... ziti-edge-tunnel (8197)[ 0.000] INFO ziti-sdk:utils.c:198 ziti_log_set_level() set log level: root=3/INFO (8197)[ 0.000] INFO ziti-sdk:utils.c:167 ziti_log_init() Ziti C SDK version 1.2.1 @g9db50a3(HEAD) starting at (2024-12-27T23:55:39.222) (8197)[ 0.000] INFO tunnel-sdk:ziti_tunnel.c:60 create_tunneler_ctx() Ziti Tunneler SDK (v1.2.10-beta14) (8197)[ 0.000] INFO tunnel-cbs:ziti_dns.c:173 seed_dns() DNS configured with range 100.64.0.0 - 100.127.255.255 (4194302 ips) (8197)[ 0.000] INFO ziti-edge-tunnel:ziti-edge-tunnel.c:1022 make_socket_path() effective group set to 'ziti' (gid=988) (8197)[ 0.019] WARN ziti-edge-tunnel:instance.c:39 find_tunnel_identity() Identity ztx[EC2-private.json] is not loaded yet or already removed. (8197)[ 0.019] INFO tunnel-cbs:ziti_tunnel_ctrl.c:1135 load_ziti_async() attempting to load ziti instance[EC2-private.json] (8197)[ 0.019] INFO tunnel-cbs:ziti_tunnel_ctrl.c:1142 load_ziti_async() loading ziti instance[EC2-private.json] (8197)[ 0.019] INFO ziti-edge-tunnel:ziti-edge-tunnel.c:425 load_id_cb() identity[EC2-private.json] loaded (8197)[ 0.020] INFO ziti-sdk:ziti.c:425 ziti_start_internal() ztx[0] enabling Ziti Context (8197)[ 0.020] INFO ziti-edge-tunnel:resolvers.c:68 init_libsystemd() Initializing libsystemd (8197)[ 0.020] INFO ziti-sdk:ziti.c:442 ziti_start_internal() ztx[0] using tlsuv[v0.32.8/OpenSSL 3.3.1 4 Jun 2024] (8197)[ 0.020] INFO ziti-sdk:ziti_ctrl.c:604 ziti_ctrl_init() ctrl[(null):] using https://ziti-controller.example.com:443/edge/client/v1 (8197)[ 0.020] INFO ziti-sdk:ziti.c:512 ztx_init_controller() ztx[0] Loading ziti context with controller[https://ziti-controller.example.com:443/edge/client/v1] (8197)[ 0.081] INFO ziti-sdk:ziti.c:1778 version_pre_auth_cb() ztx[0] connected to Legacy controller https://ziti-controller.example.com:443/edge/client/v1 version v1.1.15(0eec47ce3c80 2024-10-02T12:59:41Z) (8197)[ 0.109] INFO ziti-edge-tunnel:ziti-edge-tunnel.c:798 on_event() ztx[EC2-private.json] API Event with controller address : (null) (8197)[ 0.111] ERROR tunnel-cbs:ziti_tunnel_ctrl.c:1571 update_config_done() updated config file with new URL (8197)[ 0.113] INFO tunnel-cbs:ziti_tunnel_ctrl.c:981 on_ziti_event() ziti_ctx[EC2-private] connected to controller (8197)[ 0.113] INFO ziti-edge-tunnel:ziti-edge-tunnel.c:463 on_event() ztx[EC2-private.json] context event : status is OK (8197)[ 0.140] INFO ziti-sdk:channel.c:272 new_ziti_channel() ch[0] (router-private) new channel for ztx[0] identity[EC2-private] (8197)[ 0.140] INFO tunnel-cbs:ziti_tunnel_ctrl.c:1052 on_ziti_event() ztx[EC2-private] added edge router router-private@ziti-router-private.example.com (8197)[ 0.140] INFO ziti-sdk:channel.c:801 reconnect_channel() ch[0] reconnecting NOW (8197)[ 0.343] INFO tunnel-cbs:ziti_tunnel_cbs.c:414 new_ziti_intercept() creating intercept for service[apache-service] with intercept.v1 = { "addresses": [ "10.100.99.99" ], "portRanges": [ { "high": 80, "low": 80 } ], "protocols": [ "tcp" ] } (8197)[ 0.343] INFO tunnel-cbs:ziti_tunnel_ctrl.c:938 on_service() starting intercepting for service[apache-service] (8197)[ 0.343] INFO ziti-edge-tunnel:ziti-edge-tunnel.c:611 on_event() =============== service event (added) - apache-service:1Yq8uc7EIO0FYT6dD2311q =============== (8197)[ 0.343] INFO ziti-edge-tunnel:tun.c:196 tun_commit_routes() starting 2 route updates (8197)[ 0.347] INFO ziti-edge-tunnel:tun.c:118 route_updates_done() route updates[2]: 0/OK (8197)[ 0.373] INFO ziti-sdk:channel.c:699 hello_reply_cb() ch[0] connected. EdgeRouter version: v1.1.15|0eec47ce3c80|2024-10-02T12:59:41Z|linux|amd64 (8197)[ 0.373] INFO tunnel-cbs:ziti_tunnel_ctrl.c:1056 on_ziti_event() ztx[EC2-private] router router-private connected (8197)[ 0.373] INFO ziti-edge-tunnel:resolvers.c:402 try_libsystemd_resolver() systemd-resolved selected as DNS resolver manager (8197)[ 1.107] INFO ziti-sdk:posture.c:206 ziti_send_posture_data() ztx[0] first run or potential controller restart detected
Any guidance or insights to resolve this issue would be greatly appreciated. Thank you!