Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Release-1.27] - Panic when etcd-snapshot-dir does not exist #9390

Closed
brandond opened this issue Feb 7, 2024 · 2 comments
Closed

[Release-1.27] - Panic when etcd-snapshot-dir does not exist #9390

brandond opened this issue Feb 7, 2024 · 2 comments
Assignees
Milestone

Comments

@brandond
Copy link
Member

brandond commented Feb 7, 2024

Backport fix for Panic when etcd-snapshot-dir does not exist

@brandond brandond self-assigned this Feb 7, 2024
@brandond brandond moved this from New to Working in K3s Development Feb 7, 2024
@brandond brandond added this to the v1.27.11+k3s1 milestone Feb 7, 2024
@brandond brandond moved this from Working to To Test in K3s Development Feb 13, 2024
@brandond brandond moved this from To Test to Working in K3s Development Feb 15, 2024
@brandond
Copy link
Member Author

Moving this out to the next release to fix the prune subcommand.

@aganesh-suse
Copy link

Validated on release-1.27 branch with commit 1268cf0

Environment Details

Infrastructure

  • Cloud
  • Hosted

Node(s) CPU architecture, OS, and Version:

$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.2 LTS"

$ uname -m
x86_64

Cluster Configuration:

HA: 3 server/ 1 agent

Config.yaml:

token: xxxx
cluster-init: true
write-kubeconfig-mode: "0644"
node-external-ip: 1.1.1.1
node-label:
- k3s-upgrade=server

etcd-snapshot-retention: 2
etcd-snapshot-schedule-cron: "* * * * *"
etcd-s3: true
etcd-s3-access-key: xxxx
etcd-s3-secret-key: xxxx
etcd-s3-bucket: xxxx
etcd-s3-folder: xxxx
etcd-s3-region: xxxx

etcd-snapshot-dir: '/does/not/exist'

debug: true

Testing Steps

  1. Copy config.yaml
$ sudo mkdir -p /etc/rancher/k3s && sudo cp config.yaml /etc/rancher/k3s
  1. Install k3s
curl -sfL https://get.k3s.io | sudo INSTALL_K3S_COMMIT='1268cf0a02e509071ab8843129b8561aed3a1ffd' sh -s - server
  1. Verify Cluster Status:
kubectl get nodes -o wide
kubectl get pods -A
  1. Verify etcd-snapshot operations: save, prune, list, delete
sudo /usr/local/bin/k3s etcd-snapshot list
sudo /usr/local/bin/k3s etcd-snapshot save
sudo /usr/local/bin/k3s etcd-snapshot prune
sudo /usr/local/bin/k3s etcd-snapshot delete <snapshot>

Validation Results:

  • k3s version used for validation:
k3s version v1.27.11+k3s-1268cf0a (1268cf0a)
go version go1.21.7

Save:

 $ sudo /usr/local/bin/k3s etcd-snapshot save 
time="2024-03-11T18:42:04Z" level=warning msg="Unknown flag --token found in config.yaml, skipping\n"
time="2024-03-11T18:42:04Z" level=warning msg="Unknown flag --etcd-snapshot-schedule-cron found in config.yaml, skipping\n"
time="2024-03-11T18:42:04Z" level=warning msg="Unknown flag --cluster-init found in config.yaml, skipping\n"
time="2024-03-11T18:42:04Z" level=warning msg="Unknown flag --write-kubeconfig-mode found in config.yaml, skipping\n"
time="2024-03-11T18:42:04Z" level=warning msg="Unknown flag --node-external-ip found in config.yaml, skipping\n"
time="2024-03-11T18:42:04Z" level=warning msg="Unknown flag --node-label found in config.yaml, skipping\n"
time="2024-03-11T18:42:04Z" level=debug msg="Attempting to retrieve extra metadata from k3s-etcd-snapshot-extra-metadata ConfigMap"
time="2024-03-11T18:42:04Z" level=debug msg="Error encountered attempting to retrieve extra metadata from k3s-etcd-snapshot-extra-metadata ConfigMap, error: configmaps \"k3s-etcd-snapshot-extra-metadata\" not found"
time="2024-03-11T18:42:04Z" level=fatal msg="failed to get etcd-snapshot-dir: stat /does/not/exist: no such file or directory"

Prune:

 $ sudo /usr/local/bin/k3s etcd-snapshot prune
time="2024-03-11T18:43:11Z" level=warning msg="Unknown flag --token found in config.yaml, skipping\n"
time="2024-03-11T18:43:11Z" level=warning msg="Unknown flag --etcd-snapshot-schedule-cron found in config.yaml, skipping\n"
time="2024-03-11T18:43:11Z" level=warning msg="Unknown flag --cluster-init found in config.yaml, skipping\n"
time="2024-03-11T18:43:11Z" level=warning msg="Unknown flag --write-kubeconfig-mode found in config.yaml, skipping\n"
time="2024-03-11T18:43:11Z" level=warning msg="Unknown flag --node-external-ip found in config.yaml, skipping\n"
time="2024-03-11T18:43:11Z" level=warning msg="Unknown flag --node-label found in config.yaml, skipping\n"
time="2024-03-11T18:43:11Z" level=fatal msg="failed to get etcd-snapshot-dir: stat /does/not/exist: no such file or directory"

List:

$ sudo k3s etcd-snapshot list
WARN[0000] Unknown flag --token found in config.yaml, skipping
WARN[0000] Unknown flag --server found in config.yaml, skipping
WARN[0000] Unknown flag --write-kubeconfig-mode found in config.yaml, skipping
WARN[0000] Unknown flag --node-external-ip found in config.yaml, skipping
WARN[0000] Unknown flag --node-label found in config.yaml, skipping
FATA[0000] failed to get etcd-snapshot-dir: stat /does/not/exist: no such file or directory

Delete:

$ sudo k3s etcd-snapshot delete on-demand-ip-x
WARN[0000] Unknown flag --token found in config.yaml, skipping
WARN[0000] Unknown flag --server found in config.yaml, skipping
WARN[0000] Unknown flag --write-kubeconfig-mode found in config.yaml, skipping
WARN[0000] Unknown flag --node-external-ip found in config.yaml, skipping
WARN[0000] Unknown flag --node-label found in config.yaml, skipping
FATA[0000] failed to get etcd-snapshot-dir: stat /does/not/exist: no such file or directory

@github-project-automation github-project-automation bot moved this from To Test to Done Issue in K3s Development Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants