sealerio / sealer

Build, Share and Run Both Your Kubernetes Cluster and Distributed Applications (Project under CNCF)
http://sealer.cool
Apache License 2.0
2.05k stars 360 forks source link

failed to initialize cluster- docker command not found #1449

Open imdingtalk opened 2 years ago

imdingtalk commented 2 years ago

What happened:

[root@localhost ~]# sealer run kubernetes:v1.20.0  --masters 10.1.3.70 --passwd 1
2022-05-30 09:01:32 [INFO] [local.go:288] Start to create a new cluster: master [10.1.3.70], worker []
2022-05-30 09:01:53 [INFO] [kube_certs.go:234] APIserver altNames :  {map[apiserver.cluster.local:apiserver.cluster.local kubernetes:kubernetes kubernetes.default:kubernetes.default kubernetes.default.svc:kubernetes.default.svc kubernetes.default.svc.cluster.local:kubernetes.default.svc.cluster.local localhost:localhost localhost.localdomain:localhost.localdomain] map[10.1.3.70:10.1.3.70 10.103.97.2:10.103.97.2 10.96.0.1:10.96.0.1 127.0.0.1:127.0.0.1 172.16.0.181:172.16.0.181]}
2022-05-30 09:01:53 [INFO] [kube_certs.go:254] Etcd altnames : {map[localhost:localhost localhost.localdomain:localhost.localdomain] map[10.1.3.70:10.1.3.70 127.0.0.1:127.0.0.1 ::1:::1]}, commonName : localhost.localdomain
2022-05-30 09:01:53 [INFO] [kube_certs.go:262] sa.key sa.pub already exist
2022-05-30 09:01:55 [INFO] [kubeconfig.go:277] [kubeconfig] Using existing kubeconfig file: "/var/lib/sealer/data/my-cluster/admin.conf"

2022-05-30 09:01:55 [INFO] [kubeconfig.go:277] [kubeconfig] Using existing kubeconfig file: "/var/lib/sealer/data/my-cluster/controller-manager.conf"

2022-05-30 09:01:55 [INFO] [kubeconfig.go:277] [kubeconfig] Using existing kubeconfig file: "/var/lib/sealer/data/my-cluster/scheduler.conf"

2022-05-30 09:01:55 [INFO] [kubeconfig.go:277] [kubeconfig] Using existing kubeconfig file: "/var/lib/sealer/data/my-cluster/kubelet.conf"

++ dirname init-registry.sh
+ cd .
+ REGISTRY_PORT=5000
+ VOLUME=/var/lib/sealer/data/my-cluster/rootfs/registry
+ REGISTRY_DOMAIN=sea.hub
+ container=sealer-registry
+++ pwd
++ dirname /var/lib/sealer/data/my-cluster/rootfs/scripts
+ rootfs=/var/lib/sealer/data/my-cluster/rootfs
+ config=/var/lib/sealer/data/my-cluster/rootfs/etc/registry_config.yml
+ htpasswd=/var/lib/sealer/data/my-cluster/rootfs/etc/registry_htpasswd
+ certs_dir=/var/lib/sealer/data/my-cluster/rootfs/certs
+ image_dir=/var/lib/sealer/data/my-cluster/rootfs/images
+ mkdir -p /var/lib/sealer/data/my-cluster/rootfs/registry
+ load_images
+ for image in "$image_dir"/*
+ '[' -f /var/lib/sealer/data/my-cluster/rootfs/images/registry.tar ']'
+ docker load -q -i /var/lib/sealer/data/my-cluster/rootfs/images/registry.tar
init-registry.sh: line 37: docker: command not found
Error: failed to init master0 failed to execute command(cd /var/lib/sealer/data/my-cluster/rootfs/scripts && sh init-registry.sh 5000 /var/lib/sealer/data/my-cluster/rootfs/registry sea.hub) on host(10.1.3.70): error(exit status 127)
Usage:
  sealer run [flags]

Examples:

create cluster to your bare metal server, appoint the iplist:
    sealer run kubernetes:v1.19.8 --masters 192.168.0.2,192.168.0.3,192.168.0.4 \
        --nodes 192.168.0.5,192.168.0.6,192.168.0.7 --passwd xxx

specify server SSH port :
  All servers use the same SSH port (default port: 22):
    sealer run kubernetes:v1.19.8 --masters 192.168.0.2,192.168.0.3,192.168.0.4 \
    --nodes 192.168.0.5,192.168.0.6,192.168.0.7 --port 24 --passwd xxx

  Different SSH port numbers exist:
    sealer run kubernetes:v1.19.8 --masters 192.168.0.2,192.168.0.3:23,192.168.0.4:24 \
    --nodes 192.168.0.5:25,192.168.0.6:25,192.168.0.7:27 --passwd xxx

create a cluster with custom environment variables:
    sealer run -e DashBoardPort=8443 mydashboard:latest  --masters 192.168.0.2,192.168.0.3,192.168.0.4 \
    --nodes 192.168.0.5,192.168.0.6,192.168.0.7 --passwd xxx

Flags:
      --cluster-name string   set cluster name (default "my-cluster")
      --cmd-args strings      set args for image cmd instruction
  -e, --env strings           set custom environment variables
  -h, --help                  help for run
  -m, --masters string        set Count or IPList to masters
  -n, --nodes string          set Count or IPList to nodes
  -p, --passwd string         set cloud provider or baremetal server password
      --pk string             set baremetal server private key (default "/root/.ssh/id_rsa")
      --pk-passwd string      set baremetal server private key password
      --port uint16           set the sshd service port number for the server (default port: 22) (default 22)
      --provider ALI_CLOUD    set infra provider, example ALI_CLOUD, the local server need ignore this
  -u, --user string           set baremetal server username (default "root")

Global Flags:
      --config string   config file (default is $HOME/.sealer.json)
  -d, --debug           turn on debug mode
      --hide-path       hide the log path
      --hide-time       hide the log time

failed to init master0 failed to execute command(cd /var/lib/sealer/data/my-cluster/rootfs/scripts && sh init-registry.sh 5000 /var/lib/sealer/data/my-cluster/rootfs/registry sea.hub) on host(10.1.3.70): error(exit status 127)

What you expected to happen:

Successfully initialized the cluster

How to reproduce it (as minimally and precisely as possible):

One initializes the operating system, then executes sealer run xxx

Anything else we need to know?:

Environment:

iosx commented 2 years ago

I have the same problem on OpenEuler 22.03.

Error: mount rootfs failed exec init.sh failed failed to execute command(cd /var/lib/sealer/data/my-cluster/rootfs  && chmod +x scripts/* && cd scripts && bash init.sh /var/lib/docker sea.hub 5000) on host(192.168.254.10): error(exit status 1)
iosx commented 2 years ago

It's the same problem with #1454, this issue can be closed.

allencloud commented 2 years ago

It's the same problem with #1454, this issue can be closed.

@iosx I do not think they are the same issue. This issue's problem is init-registry.sh: line 37: docker: command not found

While https://github.com/sealerio/sealer/issues/1454 is the the Ubuntu 22.04 LTS make the sh linked to /bin/dash, rather than /bin/bash.

But they both occurred in the shell srcipts of cd /var/lib/sealer/data/my-cluster/rootfs && chmod +x scripts/* && cd scripts && bash init.sh /var/lib/docker sea.hub 5000

imdingtalk commented 2 years ago

I have the same problem on OpenEuler 22.03.

Error: mount rootfs failed exec init.sh failed failed to execute command(cd /var/lib/sealer/data/my-cluster/rootfs  && chmod +x scripts/* && cd scripts && bash init.sh /var/lib/docker sea.hub 5000) on host(192.168.254.10): error(exit status 1)

Does the node have a tar command? My problem is caused by the lack of the tar command