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

No container engine client available #7484

Closed
jandubois opened this issue Sep 13, 2024 · 2 comments · Fixed by #7515
Closed

No container engine client available #7484

jandubois opened this issue Sep 13, 2024 · 2 comments · Fixed by #7515
Assignees
Labels
area/kubernetes k8s and related, like traefik kind/bug Something isn't working
Milestone

Comments

@jandubois
Copy link
Member

jandubois commented Sep 13, 2024

Currently the channel server at https://update.k3s.io/v1-release/channel has periodic problems that look like the results of a DoS attack. This could result in issue #7412, which was supposed to be fixed by #7461.

However, it turns out the trigger condition for #7412 was not just the failure of the channel server, but also that the k3s-versions.json file had been removed from the cache directory while the settings.json file remained and had Kubernetes enabled.

After the fix from #7461 this trigger now results in a different error:

CleanShot 2024-09-13 at 13 35 48@2x

I simulate the channel server failure by redirecting the request to a local http server. It seems important that the request returns a 2XX response and not a 404:

--- pkg/rancher-desktop/backend/k3sHelper.ts
+++ pkg/rancher-desktop/backend/k3sHelper.ts
@@ -126,8 +126,8 @@ export function buildVersion(version: semver.SemVer) {
 }

 export default class K3sHelper extends events.EventEmitter {
-  protected readonly channelApiUrl = 'https://update.k3s.io/v1-release/channels';
-  protected readonly channelApiAccept = 'application/json';
+  protected readonly channelApiUrl = 'http://localhost';
+  protected readonly channelApiAccept = 'text/html';
   protected readonly releaseApiUrl = 'https://api.github.com/repos/k3s-io/k3s/releases?per_page=100';
   protected readonly releaseApiAccept = 'application/vnd.github.v3+json';
   protected readonly cachePath = path.join(paths.cache, 'k3s-versions.json');
@jandubois jandubois added kind/bug Something isn't working area/kubernetes k8s and related, like traefik labels Sep 13, 2024
@jandubois
Copy link
Member Author

I'm temporarily still putting this into the 1.16 milestone, but feel free to move to 1.17 if the fix is non-trivial, as the trigger condition seems rather uncommon,

@jandubois jandubois modified the milestones: 1.16, 1.17 Sep 13, 2024
@mook-as
Copy link
Contributor

mook-as commented Sep 19, 2024

Clearer steps to reproduce:

  1. Run Rancher Desktop normally, enabling Kubernetes (and let it cache k3s)
  2. Edit k3sHelper.ts and change channelApiUrl to https://github.com/rancher-sandbox/rancher-desktop/raw/refs/heads/main/package.json (a valid JSON filed, but not expected contents)
  3. Remove k3s-versions.json
  4. Start Rancher Desktop.

Relevant logs:

k8s.log           ─2024-09-19T11:29:00.940-0700: Got K3s update channel data: undefined
kube.log          ┌2024-09-19T11:29:00.941-0700: k3sHelper.initialize failed:  Error: Channel response does not have correct resource type: undefined
kube.log          │    at K3sHelper.updateCache (…/dist/app/background.js:21748:27)
kube.log          │    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
kube.log          └    at async …/dist/app/background.js:21853:17
k8s.log           ─2024-09-19T11:29:00.941-0700: Error: Channel response does not have correct resource type: undefined
background.log    ┌2024-09-19T11:29:00.941-0700: UnhandledRejectionWarning: Error: Channel response does not have correct resource type: undefined
background.log    │    at K3sHelper.updateCache (…/dist/app/background.js:21748:27)
background.log    │    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
background.log    └    at async …/dist/app/background.js:21853:17                                  
kube.log          ─2024-09-19T11:29:22.523-0700: Could not get desired version: Error: Channel response does not have correct resource type: undefined
k8s.log           ─2024-09-19T11:29:22.523-0700: Got installed k3s version: 1.30.4+k3s1 (k3s version v1.30.4+k3s1)
background.log    ┌2024-09-19T11:29:22.524-0700: Kubernetes was unable to start: Error: Invalid state, no container engine client available.
background.log    │    at get containerEngineClient (…/dist/app/background.js:24181:15)
background.log    │    at startK8sManager (…/dist/app/background.js:45692:49)
background.log    │    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
background.log    │    at async startBackend (/…/dist/app/background.js:45669:9)
background.log    └    at async …/dist/app/background.js:45460:9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubernetes k8s and related, like traefik kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants