kubernetes: Kubeadm inside docker container fails
When trying to install Kubeadm inside Ubuntu 16.04 docker container it fails.
BUG REPORT
Kubernetes version (use kubectl version
):
latest
Environment: Ubuntu 16.04 Docker container
What happened: When trying to install Kubeadm inside Ubuntu 16.04 docker container it fails. My Idea was to use one docker container as master “node” and a second container as a worker “node” (kubernetes in docker) Is this a systemd issue? (something I came across when “googling” for answers)
Inside Ubuntu 16.04 docker image I install with : apt-get install -y kubeadm
setup log:
...
...
...
all: Setting up socat (1.7.3.1-1) ...
all: Setting up kubelet (1.4.3-00) ...
all: /var/lib/dpkg/info/kubelet.postinst: 38: /var/lib/dpkg/info/kubelet.postinst: [[: not found
all: Setting up kubectl (1.4.3-00) ...
all: Setting up kubeadm (1.5.0-alpha.0-1534-gcf7301f-00) ...
all: Failed to connect to bus: No such file or directory
**all: dpkg: error processing package kubeadm (--configure):**
all: subprocess installed post-installation script returned error exit status 1
all: Setting up netcat-traditional (1.10-41) ...
all: update-alternatives: using /bin/nc.traditional to provide /bin/nc (nc) in auto mode
all: Setting up netcat (1.10-41) ...
all: Setting up patch (2.7.5-1) ...
all: Setting up rename (0.20-4) ...
all: update-alternatives: using /usr/bin/file-rename to provide /usr/bin/rename (rename) in auto mode
all: Setting up tcpd (7.6.q-25) ...
all: Setting up ubuntu-fan (0.9.1) ...
all: invoke-rc.d: could not determine current runlevel
all: invoke-rc.d: policy-rc.d denied execution of start.
all: Setting up xz-utils (5.1.1alpha+20120614-2ubuntu2) ...
all: update-alternatives: using /usr/bin/xz to provide /usr/bin/lzma (lzma) in auto mode
all: Setting up python3 (3.5.1-3) ...
all: running python rtupdate hooks for python3.5...
all: running python post-rtupdate hooks for python3.5...
all: Setting up apparmor (2.10.95-0ubuntu2.2) ...
all: update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
all: Setting up dh-python (2.20151103ubuntu1.1) ...
all: Processing triggers for libc-bin (2.23-0ubuntu4) ...
all: Processing triggers for systemd (229-4ubuntu11) ...
all: Processing triggers for initramfs-tools (0.122ubuntu8.5) ...
all: Processing triggers for dbus (1.10.6-1ubuntu3) ...
all: Errors were encountered while processing:
all: kubeadm
all: E: Sub-process /usr/bin/dpkg returned an error code (1)
==> all: Killing the container: 93babb5045461c343a803109ba683a2acf68f1f453447a336b09171a1b190f38
Build 'all' errored: Script exited with non-zero exit status: 100
==> Some builds didn't complete successfully and had errors:
--> all: Script exited with non-zero exit status: 100
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 3
- Comments: 16 (11 by maintainers)
There are two main issues regarding to installation kubeadm in Docker container. First is systemd running in container. Second is installation docker inside container. Successfully the problems were fixed. Here is the Dockerfile which must be used to prepare Ubuntu image
I use this command to build the image in the directory containing the Dockerfile
Now you can run prepared image and finish kubeadm installation. Use the following command to run
kubeadm_docker
image:Find running container ID
Now you can open container console:
This is your script (with small modifications) to install kubeadm
And finally you can execute
Everything works the same like on local machine. Good luck 😃