During creation of a K3S cluster with ubuntu/jammy64 box. When creating the control plane VM, K3S is installed and then permissions are set on the k3s.yaml file for group k3s members, of which vagrant is added.
During provisioning the -v flag shows chmod correctly changed permissions.
Immediately upon completion, if I login and check again, the permission change has been reverted.
case host[:type]
when "control"
node.vm.provision "install-k3s-server", type: "shell", inline: <<-SHELL
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.22.7+k3s1 sh -
SHELL
node.vm.provision "k3s-write-server-token", type: "shell", inline: <<-SHELL
K3S_TOKEN=$(sudo cat /var/lib/rancher/k3s/server/node-token)
echo $K3S_TOKEN > /vagrant_data/k3s_token
SHELL
node.vm.provision "k3s-group-permissions", type: "shell", inline: <<-SHELL
sudo groupadd k3s
sudo usermod -a -G k3s vagrant
sudo chown root:k3s /etc/rancher/k3s/k3s.yaml
sudo chmod -v 740 /etc/rancher/k3s/k3s.yaml
SHELL
Log of vagrant up. This demonstrates permissions changed successfully.
==> dev-kubnode01l.home: Running provisioner: k3s-group-permissions (shell)...
dev-kubnode01l.home: Running: inline script
dev-kubnode01l.home: mode of '/etc/rancher/k3s/k3s.yaml' changed from 0600 (rw-------) to 0740 (rwxr-----)
But after login, I check them again ... permissions change did not persist!
vagrant@dev-kubnode01l:~$ ls -l /etc/rancher/k3s/k3s.yaml
-rw------- 1 root k3s 2957 Aug 4 16:58 /etc/rancher/k3s/k3s.yaml
If I run the chmod directly, the correct permissions remain set.
Could use help suggesting the next isolation test to narrow it down.