golang function deploy fail
okyer opened this issue · comments
Is this a BUG REPORT or FEATURE REQUEST?:
FEATURE REQUEST
What happened:
// helloget.go
package kubeless
import (
"fmt"
"github.com/kubeless/kubeless/pkg/functions"
)
func Foo(event functions.Event, context functions.Context) (string, error) {
fmt.Println(event)
return event.Data, nil
}
_kubeless function deploy get-go --runtime go1.14 --handler helloget.Foo --from-file helloget.go_
_kubeless function ls_
NAME NAMESPACE HANDLER RUNTIME DEPENDENCIES STATUS
get-go kubeless helloget.Foo go1.14 0/1 NOT READY
_kubectl get pod_
NAME READY STATUS RESTARTS AGE
get-go-8885d7974-9rqn7 0/1 Init:CrashLoopBackOff 5 4m3s
_kubectl describe pod get-go-8885d7974-9rqn7_
......
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled <unknown> default-scheduler Successfully assigned kubeless/get-go-8885d7974-9rqn7 to minikube
Normal Pulled 5m38s kubelet, minikube Container image "kubeless/unzip@sha256:4863100364496255de9bf8722a220dad7143ab277ac72435876eb8c93936e9d7" already present on machine
Normal Created 5m38s kubelet, minikube Created container prepare
Normal Started 5m38s kubelet, minikube Started container prepare
Normal Pulled 3m39s (x5 over 5m37s) kubelet, minikube Container image "kubeless/go-init:1.14@sha256:403164254efabf735e98e73b7f6f65f14333ed792798c7c3d3d9a33ca91acf7a" already present on machine
Normal Created 3m39s (x5 over 5m37s) kubelet, minikube Created container compile
Normal Started 3m39s (x5 over 5m37s) kubelet, minikube Started container compile
Warning BackOff 26s (x22 over 5m6s) kubelet, minikube Back-off restarting failed container
What you expected to happen:
kubectl logs get-go-8885d7974-9rqn7
Error from server (BadRequest): container "get-go" in pod "get-go-8885d7974-9rqn7" is waiting to start: PodInitializing
How to reproduce it (as minimally and precisely as possible):
Anything else we need to know?:
_kubectl get pod get-go-8885d7974-9rqn7 -o yaml_
......
initContainerStatuses:
- containerID: docker://fe85fffecba5c6ea7dac975cd18452b4e2e952f562bc56f80ab462615c0d3a37
image: sha256:abb7a6ac3e05182bb91f84f508f30627fea89a9ee6bbcbd32a00f4bb7a85a66e
imageID: docker-pullable://kubeless/unzip@sha256:4863100364496255de9bf8722a220dad7143ab277ac72435876eb8c93936e9d7
lastState: {}
name: prepare
ready: true
restartCount: 0
state:
terminated:
containerID: docker://fe85fffecba5c6ea7dac975cd18452b4e2e952f562bc56f80ab462615c0d3a37
exitCode: 0
finishedAt: "2020-12-03T10:27:28Z"
reason: Completed
startedAt: "2020-12-03T10:27:28Z"
- containerID: docker://253c078261ed9608f403382553b88ec18214900801769602851f55c11d3569a5
image: sha256:fa030871281d1c33698dadd62f802befec57aadfc09c8371385d47f5fb1a3b72
imageID: docker-pullable://kubeless/go-init@sha256:403164254efabf735e98e73b7f6f65f14333ed792798c7c3d3d9a33ca91acf7a
lastState:
terminated:
containerID: docker://253c078261ed9608f403382553b88ec18214900801769602851f55c11d3569a5
exitCode: 1
finishedAt: "2020-12-03T10:30:57Z"
reason: Error
startedAt: "2020-12-03T10:30:57Z"
name: compile
ready: false
restartCount: 5
state:
waiting:
message: back-off 2m40s restarting failed container=compile pod=get-go-8885d7974-9rqn7_kubeless(ef941b04-a525-40b4-a2a3-6da5a47fc778)
reason: CrashLoopBackOff
phase: Pending
Environment:
-
Kubernetes version (use
kubectl version
):
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.6", GitCommit:"dff82dc0de47299ab66c83c626e08b245ab19037", GitTreeState:"clean", BuildDate:"2020-07-15T16:58:53Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.3", GitCommit:"2e7996e3e2712684bc73f0dec0200d64eec7fe40", GitTreeState:"clean", BuildDate:"2020-05-20T12:43:34Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"} -
Kubeless version (use
kubeless version
):
Kubeless version: v1.0.7-dirty -
Cloud provider or physical cluster:
minikube version: v1.12.0
the error is hiding in the compile
init container. You can get the details of the error executing:
kubectl logs get-go-8885d7974-9rqn7 -c compile
@andresmgot thank you, using this method, I found a problem and solved the problem.
kubectl logs get-go-8885d7974-9rqn7 -c compile
rm: cannot remove '/kubeless/go.mod': No such file or directory
need --dependencies
when deploy a function.