helm-charts icon indicating copy to clipboard operation
helm-charts copied to clipboard

Inject containerRuntime config failed

Open linuzb opened this issue 1 year ago â€ĸ 2 comments
trafficstars

Bug report:

The config_path setting within the containerd configuration occasionally fails to be injected properly.

Expected behavior:

The config_path is intended to be successfully injected in the end; nonetheless, if injection fails at any point, it is imperative that the process either retries or throws an error to promptly notify the user.

How to reproduce it:

kind config

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
  - role: control-plane
  - role: worker
  - role: worker

use kind to install kubernetes

$ kind create cluster --config kind-config.yaml
Creating cluster "kind" ...
 ✓ Ensuring node image (kindest/node:v1.29.2) đŸ–ŧ
 ✓ Preparing nodes đŸ“Ļ đŸ“Ļ đŸ“Ļ
 ✓ Writing configuration 📜
 ✓ Starting control-plane đŸ•šī¸
 ✓ Installing CNI 🔌
 ✓ Installing StorageClass 💾
 ✓ Joining worker nodes 🚜
Set kubectl context to "kind-kind"
You can now use your cluster with:

kubectl cluster-info --context kind-kind

Have a nice day! 👋

kind load image

kind load docker-image dragonflyoss/scheduler:v2.1.43
kind load docker-image dragonflyoss/manager:v2.1.43
kind load docker-image dragonflyoss/dfdaemon:v2.1.43
kind load docker-image busybox:latest
kind load docker-image jaegertracing/all-in-one:1.39.0
kind load docker-image bitnami/redis:7.0.8-debian-11-r0
kind load docker-image bitnami/mysql:8.0.31-debian-11-r30
kind load docker-image dragonflyoss/openssl:latest

add charts-config.yaml

containerRuntime:
  containerd:
    enable: true
    injectConfigPath: true
    registries:
      - 'https://docker.io'
      - 'https://ghcr.io'

scheduler:
  image:
    repository: dragonflyoss/scheduler
    tag: v2.1.43
  replicas: 1
  metrics:
    enable: true
  config:
    verbose: true
    pprofPort: 18066

seedPeer:
  image:
    repository: dragonflyoss/dfdaemon
    tag: v2.1.43
  replicas: 1
  metrics:
    enable: true
  config:
    verbose: true
    pprofPort: 18066

dfdaemon:
  image:
    repository: dragonflyoss/dfdaemon
    tag: v2.1.43
  metrics:
    enable: true
  config:
    verbose: true
    pprofPort: 18066

manager:
  image:
    repository: dragonflyoss/manager
    tag: v2.1.43
  replicas: 1
  metrics:
    enable: true
  config:
    verbose: true
    pprofPort: 18066

jaeger:
  enable: true

use helm to install dragonfly

$ helm upgrade --cleanup-on-fail \
  --install dragonfly ./dragonfly \
  --namespace dragonfly-system \
  --create-namespace \
  --values charts-config.yaml

check config.toml of containerd in node, there is nothing about config_path

$ docker exec -it kind-worker2 bash
root@kind-worker2:/# grep "config_path" /etc/containerd/config.toml
root@kind-worker2:/#

check log of container update-containerd, find that there is a create error

k -n dragonfly-system logs dragonfly-dfdaemon-4dx8m -c  update-containerd

...

+ tmp=
+ '[[' -z  ]]
+ echo inject config_path into /host/etc/containerd/config.toml
+ grep -q '\[plugins."io.containerd.grpc.v1.cri".registry\]' /host/etc/containerd/config.toml
inject config_path into /host/etc/containerd/config.toml
/bin/sh: can't create /host/etc/containerd/config.toml: Interrupted system call
+ cat
+ echo 'Registry config_path /host/etc/containerd/certs.d added'
+ need_restart=1
Registry config_path /host/etc/containerd/certs.d added

...

Environment:

  • Dragonfly version: v2.1.43
  • OS: WSL debian12
  • Kernel (e.g. uname -a):
    • node of kind: Linux kind-worker2 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 GNU/Linux
    • wsl kernel: Linux debian-wsl 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 GNU/Linux
  • Others:
    • version of kind node: kindest/node:v1.29.2

linuzb avatar Jun 15 '24 09:06 linuzb

I created this PR #286 to solve this problem. When the injection script fails, it terminates immediately, and update-containerd solves the problem by retrying. Even if the retry fails, the user can be notified to avoid unexpected problems.

This picture shows the retry process f4dd5c1d4e8ed3db9eacaca65e15dc2

Even if an error occurs in the middle of the process, the configpath is injected successfully in the end. image

linuzb avatar Jun 15 '24 10:06 linuzb

@linuzb You can try the latest version of the charts, refer to https://d7y.io/docs/next/getting-started/installation/helm-charts/.

gaius-qi avatar Jul 04 '24 03:07 gaius-qi