Skip to content

Instantly share code, notes, and snippets.

@jasonbrooks
Last active October 22, 2016 16:25
Show Gist options
  • Save jasonbrooks/0620432e6491183fcd46895cf6a7b256 to your computer and use it in GitHub Desktop.
Save jasonbrooks/0620432e6491183fcd46895cf6a7b256 to your computer and use it in GitHub Desktop.

I'm trying to use this kubeadm howto with centos atomic host continuous and pkg-add:

# cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=http://yum.kubernetes.io/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
       https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF

# sed -i 's/gpgcheck=1/gpgcheck=0/g' /etc/yum.repos.d/kubernetes.repo

# rpm-ostree pkg-add kubelet kubeadm kubectl kubernetes-cni
Checking out tree 060b08b... done

Downloading metadata: [=================================================] 100%
Resolving dependencies... done
Will download: 5 packages (41.1 MB)

  Downloading from base: [==============================================] 100%

  Downloading from kubernetes: [========================================] 100%

Importing: [============================================================] 100%
Overlaying... error: Unpacking kubernetes-cni-0.3.0.1-0.07a8a2.x86_64: openat: No such file or directory

OK:

<walters> jbrooks, it's because it installs into /opt: https://pastebin.mozilla.org/8920756

# ostree --repo=/ostree/repo/extensions/rpmostree/pkgcache/ ls -R rpmostree/pkg/kubernetes-cni/0.3.0.1-0.07a8a2.x86__64
d00755 0 0      0 /
d00755 0 0      0 /opt
d00755 0 0      0 /opt/cni
d00755 0 0      0 /opt/cni/bin
-00755 0 0 4330384 /opt/cni/bin/bridge
-00755 0 0 2652936 /opt/cni/bin/cnitool
-00755 0 0 8594608 /opt/cni/bin/dhcp
-00755 0 0 2697872 /opt/cni/bin/flannel
-00755 0 0 2920808 /opt/cni/bin/host-local
-00755 0 0 3859744 /opt/cni/bin/ipvlan
-00755 0 0 3661848 /opt/cni/bin/loopback
-00755 0 0 3878280 /opt/cni/bin/macvlan
-00755 0 0 2490128 /opt/cni/bin/noop
-00755 0 0 4321984 /opt/cni/bin/ptp
-00755 0 0 2789952 /opt/cni/bin/tuning

So:

diff --git a/rpm/kubelet.spec b/rpm/kubelet.spec
index 740a18d..3d8a6ca 100644
--- a/rpm/kubelet.spec
+++ b/rpm/kubelet.spec
@@ -91,8 +91,8 @@ install -p -m 755 -t %{buildroot}%{_sysconfdir}/systemd/system/ kubelet.service
 install -p -m 755 -t %{buildroot}%{_sysconfdir}/systemd/system/kubelet.service.d/ 10-kubeadm.conf
 
 
-install -m 755 -d %{buildroot}/opt/cni
-mv bin/ %{buildroot}/opt/cni/
+install -m 755 -d %{buildroot}%{_bindir}/cni
+mv bin/ %{buildroot}%{_bindir}/cni/
 
 
 %files
@@ -101,7 +101,7 @@ mv bin/ %{buildroot}/opt/cni/
 %{_sysconfdir}/kubernetes/manifests/
 
 %files -n kubernetes-cni
-/opt/cni
+%{_bindir}/cni
 
 %files -n kubectl
 %{_bindir}/kubectl

And try again:

# cat <<EOF > /etc/yum.repos.d/jasonbrooks-kube-release-epel-7.repo
[jasonbrooks-kube-release]
name=Copr repo for kube-release owned by jasonbrooks
baseurl=https://copr-be.cloud.fedoraproject.org/results/jasonbrooks/kube-release/epel-7-x86_64/
type=rpm-md
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://copr-be.cloud.fedoraproject.org/results/jasonbrooks/kube-release/pubkey.gpg
repo_gpgcheck=0
enabled=1
enabled_metadata=1
EOF

# rpm-ostree pkg-add --reboot kubelet kubeadm kubectl kubernetes-cni
# systemctl enable kubelet.service --now

# setenforce 0

# kubeadm init
Running pre-flight checks
preflight check errors:
	/etc/kubernetes is not empty
	ebtables not found in system path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment