Installation on Kubernetes (Asset Mode)
Mode: Asset. Supported: Kubernetes nodes whose Linux kernel (5.6 or newer) supports WireGuard and that allow the NET_ADMIN and NET_RAW capabilities and the node's /dev/net/tun device. The image cr-public.xplicittrust.com/xtna-agent supports amd64, arm64 and armhf. Everything in Docker / Podman about the image applies; this page adds what is specific to Kubernetes. On AWS, see also AWS.
TL;DR
Run the agent as a single-replica Deployment with a persistent volume at /etc/XplicitTrust, the capabilities NET_ADMIN and NET_RAW, and /dev/net/tun from the node. The Deployment is below. Pass the registration flags as the container's arguments:
-token <token> -domain <tenant-domain>
Before you start
- The
tunkernel module is loaded on the nodes (modprobe tun) and/dev/net/tunexists. See The/dev/net/tundevice. - You can create a
PersistentVolumeClaimfor the agent's configuration (xtna-configin the example). The directory holds the asset's credentials: see Persistent configuration. - You have an Asset Creation Token (Registration methods).
- Outgoing TCP 443 is allowed, and UDP 51820-60000 for direct connections. See Requirements.
Install
For Kubernetes deployments, use a DaemonSet or Deployment with the required security context:
Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: xtna-agent
spec:
replicas: 1
selector:
matchLabels:
app: xtna-agent
template:
metadata:
labels:
app: xtna-agent
spec:
containers:
- name: xtna-agent
image: cr-public.xplicittrust.com/xtna-agent:latest
securityContext:
capabilities:
add:
- NET_ADMIN
- NET_RAW
volumeMounts:
- name: config
mountPath: /etc/XplicitTrust
- name: tun
mountPath: /dev/net/tun
volumes:
- name: config
persistentVolumeClaim:
claimName: xtna-config
- name: tun
hostPath:
path: /dev/net/tun
type: CharDevice
TUN device on Kubernetes
Kubernetes has no direct equivalent of --device, so the example above exposes /dev/net/tun via a hostPath volume of type CharDevice. The node must have the tun kernel module loaded (modprobe tun) and /dev/net/tun present, otherwise the pod will fail to mount the volume. Alternatively, use a TUN/TAP device plugin to avoid hostPath.
Run a single replica. Two agents must never use the same configuration directory at the same time; on AWS, see EKS for a volume that two pods cannot hold at once.
Register
Provide the registration token via a Kubernetes Secret or environment variable in your deployment pipeline, and pass the registration flags as the container's args:
args: ["-token", "<token>", "-domain", "<tenant-domain>", "-name", "k8s-gw", "-ignore-hostname"]
Registration flags are only used on first start. Once the asset is registered, its configuration is stored in the volume and the flags are ignored on later starts. The flags are listed under Registration Flags; the methods are described on Registration methods.
Verify
The asset appears under Assets in the Admin Console as Online. The agent's log is in the pod at /etc/XplicitTrust/logs/xtna-service.log:
kubectl logs deployment/xtna-agent
kubectl exec deployment/xtna-agent -- tail -f /etc/XplicitTrust/logs/xtna-service.log
See Verify your installation for the other checks. A second, additional asset after a pod restart means the configuration volume was not kept.
Next
Create a policy to give clients access to the asset: Policies. To make cluster or LAN addresses reachable, see Subnets and, for the address handling a gateway needs, IP forwarding.
IP forwarding
A gateway asset that routes packets between its tunnel interface and a network needs forwarding enabled in the container's own network namespace; see IP forwarding for why. In Kubernetes, set the sysctl in the pod's security context:
securityContext:
sysctls:
- name: net.ipv4.ip_forward
value: "1"
net.ipv4.ip_forward is namespaced but not in the kubelet's default allow-list, so the node's kubelet needs it permitted with --allowed-unsafe-sysctls=net.ipv4.ip_forward. An asset that merely makes itself reachable does not need this.
Updates
The launcher in the container updates itself and the agent service automatically (see Docker / Podman). A new image only takes effect when the pod is recreated. With the :latest tag and no imagePullPolicy set, Kubernetes pulls the image whenever it starts a new pod. Restart the deployment to roll out a new image:
kubectl rollout restart deployment/xtna-agent
Troubleshooting
- The pod fails to mount
/dev/net/tun: thetunmodule is not loaded on the node, see Before you start. - The pod exits immediately, shows
CreateTUN("xt0") failed, or the container is reachable but nothing behind it responds: the causes and checks are the same as for Docker, see Docker / Podman: Troubleshooting. - A new asset appears after every pod replacement: the volume at
/etc/XplicitTrustis not persistent.
See also
- Concept: Clients and Assets, Gateway Assets
- Guide: Docker / Podman, AWS, Registration methods
- Reference: Assets