Cloudflare DevelopersCD
Cloudflare Developers7mo ago
21 replies
Aster

Hey hey, I am trying to run k3 in a

Hey hey, I am trying to run k3 in a container, with the following:

# syntax=docker/dockerfile:1
FROM rancher/k3s:latest

# Expose the required ports for K3s
EXPOSE 6443
EXPOSE 443
EXPOSE 80

# Set the default command to run K3s server
CMD ["server", "--disable", "traefik"]


And this is my code:

export class MyContainer extends Container {
  defaultPort = 6443;
  requiredPorts = [6443, 443, 80];
  // ...
}

app.get("/readyz", async (c) => {
  const container = getContainer(c.env.MY_CONTAINER);
  return await container.fetch(c.req.raw);
});
// ...


I get the following:

⎔ Container image(s) ready
⎔ Starting local server...
✘ [ERROR] Error checking if container is ready: connect(): Connection refused: container port not found. Make sure you exposed the port in your container definition.
✘ [ERROR] Error checking if container is ready: internal error; reference = r48029i07cer86vit2h90t6i
✘ [ERROR] Error checking if container is ready: internal error; reference = df2ceaqdffenqqhpp6ka9igg
✘ [ERROR] Error checking if container is ready: internal error; reference = gist59tegar22c3tp1iaj7ac
✘ [ERROR] Error checking if container is ready: connect(): Connection refused: container port not found. Make sure you exposed the port in your container definition.
Container error: [Error: Container exited with unexpected exit code: 1] { exitCode: 1 }
▲ [WARNING] workerd/io/actor-sqlite.c++:647: warning: NOSENTRY SQLite alarm handler canceled with requestScheduledAlarm.; scheduledTime = 1753139731.815s; localAlarmState.orDefault(kj::UNIX_EPOCH) = 1753139733.074s; actorId = b60d370ee54d17e273624ceb809e666d47bc8cb445b274c648f7e06520b5a613
[wrangler:info] GET /readyz 500 Internal Server Error


Any idea what could be the issue? 🤔
Was this page helpful?