1. Cause
When I run Ubuntu through k8s, I execute the following script
#!/bin/bash
service ssh start
echo root:$1|chpasswd
After the container is started, there is no resident foreground process inside the container, which causes the container to exit after the container is started successfully, thus continuing to restart.
2. Solution
At startup, perform a task that will never be completed
command: ["/bin/bash", "-ce", "tail -f /dev/null"]
Add the following to the script above:
#!/bin/bash
service ssh start
echo root:$1|chpasswd
tail -f /dev/null
Successfully solved, this script can be executed successfully, and the container can be started successfully
Read More:
- [Solved] pod Error: back off restarting failed container
- K8S Master Initialize Error: [ERROR CRI]: container runtime is not running: output: E0812
- [Solved] k8s kubeadmin init Error: http://localhost:10248/healthz‘ failed
- [Solved] K8s Initialize Error: failed with error: Get “http://localhost:10248/healthz“
- K8s initializing the master & worker node error [How to Solve]
- [Solved] Ubuntu 20.04 LTS Install k8s Error: The connection to the server localhost:8080 was refused
- How to Solve kubelet starts error (k8s Cluster Restarted)
- K8s ❉ Error: cannot be handled as a** [How to Solve]
- K8s cluster initialization error: Port 6443 is in use [Solved]
- How to Solve k8s Nodal issues: /sys/fs/cgroup/memory/docker: no space left on device\““: unknown.
- K8S error validating data: ValidationError(Deployment.spec): missing required field selector
- k8s kubernetes ingress error: endpoints “default-http-backend“ not found
- [Solved] k8s error retrieving resource lock default/fuseim.pri-ifs: Unauthorized
- [Solved] Upstream connect error or disconnect occurs after the k8s istio virtual machine is restarted
- [Solved] K8s cluster build error: error: kubectl get csr No resources found.
- K8s Install Error: Error: unknown flag: –experimental-upload-certs
- [Solved] K8s Error: ERROR: Unable to access datastore to query node configuration
- [Solved] CCS compilation and debug error: Source lookup: unable to restore CPU specific source container – expecting valid source container id value.
- Docker run Error: container_linux.go:235: starting container process caused “process_linux.go:258: appl
- [Solved] Spring MVC Error: A child container failed during start