Repository navigation
Closed
Labels
Description
What is the issue?
The subnet-router pod would fail with lots of permission errors. I expected that to not happen. I fixed it with the following subnet-router manifest (not sure if the capabilities are necessary):
# Copyright (c) Tailscale Inc & AUTHORS
# SPDX-License-Identifier: BSD-3-Clause
apiVersion: v1
kind: Pod
metadata:
name: subnet-router
labels:
app: tailscale
spec:
serviceAccountName: "tailscale"
containers:
- name: tailscale
imagePullPolicy: Always
image: "ghcr.io/tailscale/tailscale:latest"
env:
# Store the state in a k8s secret
- name: TS_KUBE_SECRET
value: "tailscale-auth"
- name: TS_USERSPACE
value: "true"
- name: TS_DEBUG_FIREWALL_MODE
value: auto
- name: TS_AUTHKEY
valueFrom:
secretKeyRef:
name: tailscale-auth
key: TS_AUTHKEY
optional: true
- name: TS_ROUTES
value: "10.43.0.0/16,10.42.0.0/16"
securityContext:
runAsUser: 1000
runAsGroup: 1000
privileged: true
capabilities:
add:
- NET_ADMINnotably, the change that made it work was setting TS_USERSPACE to true
Logs:
boot: 2024/05/10 06:07:50 Starting tailscaled
boot: 2024/05/10 06:07:50 Waiting for tailscaled socket
2024/05/10 06:07:50 logtail started
2024/05/10 06:07:50 Program starting: v1.64.2-tede81e266, Go 1.22.2: []string{"tailscaled", "--socket=/tmp/tailscaled.sock", "--state=kube:tailscale-auth", "--statedir=/tmp"}
2024/05/10 06:07:50 LogID: 5f1b0c2437bc081d3ff03489e987ce16e27ea447340eadb9fa37113cd86ea526
2024/05/10 06:07:50 filch failed: filch: open /.cache/Tailscale/tailscaled.log1.txt: no such file or directory
2024/05/10 06:07:50 logpolicy: using UserCacheDir, "/.cache/Tailscale"
logpolicy.ConfigFromFile /.cache/Tailscale/tailscaled.log.conf: open /.cache/Tailscale/tailscaled.log.conf: no such file or directory
logpolicy.Config.Validate for /.cache/Tailscale/tailscaled.log.conf: config is nil
logpolicy.Config.Save for /.cache/Tailscale/tailscaled.log.conf: mkdir /.cache: permission denied
2024/05/10 06:07:50 dns: [rc=unknown ret=direct]
2024/05/10 06:07:50 dns: using "direct" mode
2024/05/10 06:07:50 dns: using *dns.directManager
2024/05/10 06:07:50 deleting [-j ts-input] in filter/INPUT: running [/sbin/iptables -t filter -D INPUT -j ts-input --wait]: exit status 4: Fatal: can't open lock file /run/xtables.lock: Permission denied
2024/05/10 06:07:50 deleting [-j ts-forward] in filter/FORWARD: running [/sbin/iptables -t filter -D FORWARD -j ts-forward --wait]: exit status 4: Fatal: can't open lock file /run/xtables.lock: Permission denied
2024/05/10 06:07:50 deleting [-j ts-postrouting] in nat/POSTROUTING: running [/sbin/iptables -t nat -D POSTROUTING -j ts-postrouting --wait]: exit status 4: Fatal: can't open lock file /run/xtables.lock: Permission denied
2024/05/10 06:07:50 linuxfw: clear iptables: multiple errors:
flushing filter/ts-input: running [/sbin/iptables -t filter -N ts-input --wait]: exit status 4: Fatal: can't open lock file /run/xtables.lock: Permission denied
flushing filter/ts-forward: running [/sbin/iptables -t filter -N ts-forward --wait]: exit status 4: Fatal: can't open lock file /run/xtables.lock: Permission denied
flushing nat/ts-postrouting: running [/sbin/iptables -t nat -N ts-postrouting --wait]: exit status 4: Fatal: can't open lock file /run/xtables.lock: Permission denied
2024/05/10 06:07:50 deleting [-j ts-input] in filter/INPUT: running [/sbin/ip6tables -t filter -D INPUT -j ts-input --wait]: exit status 4: Fatal: can't open lock file /run/xtables.lock: Permission denied
2024/05/10 06:07:50 deleting [-j ts-forward] in filter/FORWARD: running [/sbin/ip6tables -t filter -D FORWARD -j ts-forward --wait]: exit status 4: Fatal: can't open lock file /run/xtables.lock: Permission denied
2024/05/10 06:07:50 [RATELIMIT] format("deleting %v in %s/%s: %v")
2024/05/10 06:07:50 linuxfw: clear ip6tables: multiple errors:
flushing filter/ts-input: running [/sbin/ip6tables -t filter -N ts-input --wait]: exit status 4: Fatal: can't open lock file /run/xtables.lock: Permission denied
flushing filter/ts-forward: running [/sbin/ip6tables -t filter -N ts-forward --wait]: exit status 4: Fatal: can't open lock file /run/xtables.lock: Permission denied
flushing nat/ts-postrouting: running [/sbin/ip6tables -t nat -N ts-postrouting --wait]: exit status 4: Fatal: can't open lock file /run/xtables.lock: Permission denied
2024/05/10 06:07:50 cleanup: list tables: netlink receive: operation not permitted
2024/05/10 06:07:50 wgengine.NewUserspaceEngine(tun "tailscale0") ...
2024/05/10 06:07:50 Linux kernel version: 6.8.2-arch2-1
2024/05/10 06:07:50 is CONFIG_TUN enabled in your kernel? `modprobe tun` failed with: modprobe: can't change directory to '/lib/modules': No such file or directory
2024/05/10 06:07:50 wgengine.NewUserspaceEngine(tun "tailscale0") error: tstun.New("tailscale0"): operation not permitted
2024/05/10 06:07:50 flushing log.
2024/05/10 06:07:50 logger closing down
2024/05/10 06:07:50 getLocalBackend error: createEngine: tstun.New("tailscale0"): operation not permitted
[root@srv1 k8s]# ^C
Steps to reproduce
Use a k3s cluster on Arch Linux, and try to run the subnet router example with default settings, by following the steps from the tutorial
Are there any recent changes that introduced the issue?
OS
Linux
OS version
Arch
Tailscale version
1.64.2
Other software
k3s, with cilium CNI
Bug report
BUG-fa393a85c9ba0e090e1949c33ba4f74c9d3990d077eb055e32cc1b54eb0a5819-20240510061849Z-58a10b42c8a9b55e
Reacted by mooy
Activity
shyamjos commentedon May 27, 2024
Same error in Talos cluster as well , only works when userspace mode is enabled
docs/k8s: fix subnet router manifests
docs/k8s: fix subnet router manifests (#12305)
irbekrm commentedon May 31, 2024
Hi folks, thank you for reporting the issue!
We forgot to update the security context for the sample manifests, post-changing them to run tailscale in tun mode.
We now did that in #12305 - would you be able to give it another go?
shyamjos commentedon May 31, 2024
Yes tried it last week and issue got resolved but forgot to update here , Thank you
irbekrm commentedon May 31, 2024
Thanks for confirming. I'll leave this open for a bit, to see whether that fixes it for the other folks too
docs/k8s: fix subnet router manifests (tailscale#12305)
irbekrm commentedon Aug 23, 2024
Closing as it seems like the issue has been solved.
docs/k8s: fix subnet router manifests (tailscale#12305)