Advanced-Kubernetes-Operator icon indicating copy to clipboard operation
Advanced-Kubernetes-Operator copied to clipboard

4.2.1 in-cluster-configuration Dockerfile problem

Open stevenlee87 opened this issue 1 year ago • 0 comments

我的集群是1.23.0版本

使用作者的Dockerfile发现了一些问题: FROM busybox COPY ./in-cluster /in-cluster USER 65532:65532 ENTRYPOINT /in-cluster

执行kubectl run in-cluster -i --image=docker.io/in-cluster:v0.0.1 --restart=Never --overrides='{"spec": {"imagePullSecrets": [{"name": "image-pull-secret"}]}}'会报错:

pod default/in-cluster terminated (Error)

单从image的size上来说,busybox更小。不过busybox默认的libc实现是uClibc,而我们通常运行环境使用的libc实现都是glibc,因此我们要么选择静态编译程序,要么使用busybox:glibc镜像作为base image。

所以我把Dockerfile改为: FROM busybox:glibc WORKDIR / COPY in-cluster . ENTRYPOINT ["./in-cluster"] 就可以正常执行程序了。

stevenlee87 avatar May 10 '23 09:05 stevenlee87