Another way to achieve the same effect for a microk8s
dashboard
addon is by editing the file /var/snap/microk8s/common/addons/core/addons/dashboard/dashboard.yaml
to include the --token-ttl=604800 argument within the rest of the container arguments:
containers:
- name: kubernetes-dashboard
image: kubernetesui/dashboard:v2.7.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8443
protocol: TCP
args:
- --auto-generate-certificates
- --namespace=kube-system
- --token-ttl=604800
After making this change, you can disable and enable the addon to apply the modification:
microk8s disable dashboard ; sleep 10; microk8s enable dashboard
Admittedly, this approach might seem a bit unorthodox and potentially unsustainable if the addon version gets updated. Unfortunately, there doesn't appear to be a simpler method to make this change persistently within microk8s. Ideally, one would hope for a more flexible configuration option, similar to those found at /var/snap/microk8s/current/args/
, but it seems that microk8s
doesn't currently expose customization settings for the dashboard in that location.