diff options
author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2021-12-10 15:27:30 -0500 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2021-12-10 15:27:30 -0500 |
commit | 183da8b15eaa5214da8e128ad5376012aa00544e (patch) | |
tree | ec5257d069bc6ca23a8b60628fc6bbb42058dd34 | |
parent | 9c1f90d46bc4cb4b229401b44a8ea7adf47cbedf (diff) | |
download | meta-virtualization-183da8b15eaa5214da8e128ad5376012aa00544e.tar.gz |
k8s: test init scriptmaster-wip
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
-rw-r--r-- | recipes-containers/kubernetes/kubernetes/k8s-init | 28 | ||||
-rw-r--r-- | recipes-containers/kubernetes/kubernetes_git.bb | 12 |
2 files changed, 39 insertions, 1 deletions
diff --git a/recipes-containers/kubernetes/kubernetes/k8s-init b/recipes-containers/kubernetes/kubernetes/k8s-init new file mode 100644 index 00000000..586a3b73 --- /dev/null +++ b/recipes-containers/kubernetes/kubernetes/k8s-init | |||
@@ -0,0 +1,28 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # Copyright (C) 2021 Bruce Ashfield | ||
4 | # | ||
5 | # SPDX-License-Identifier: Apache-2.0 | ||
6 | |||
7 | # cleanup the iptables | ||
8 | cp /etc/sysconfig/iptables /etc/sysconfig/iptables.ORIG && iptables --flush && iptables --flush && iptables-save > /etc/sysconfig/iptables | ||
9 | systemctl restart iptables.service | ||
10 | |||
11 | # Load/Enable br_netfilter kernel module | ||
12 | modprobe br_netfilter | ||
13 | modprobe overlay | ||
14 | |||
15 | echo '1' > /proc/sys/net/bridge/bridge-nf-call-iptables | ||
16 | echo '1' > /proc/sys/net/bridge/bridge-nf-call-ip6tables | ||
17 | echo 'net.bridge.bridge-nf-call-iptables=1' >> /etc/sysctl.d/k8s.conf | ||
18 | echo 'net.bridge.bridge-nf-call-ip6tables=1' >> /etc/sysctl.d/k8s.conf | ||
19 | echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.d/k8s.conf | ||
20 | |||
21 | systemctl restart systemd-sysctl.service | ||
22 | |||
23 | kubeadm init | ||
24 | |||
25 | # Copy the cluster configuration to the regular users home directory | ||
26 | mkdir -p $HOME/.kube | ||
27 | cp -i /etc/kubernetes/admin.conf $HOME/.kube/config | ||
28 | chown $(id -u):$(id -g) $HOME/.kube/config | ||
diff --git a/recipes-containers/kubernetes/kubernetes_git.bb b/recipes-containers/kubernetes/kubernetes_git.bb index 82edadd6..7cdef2c7 100644 --- a/recipes-containers/kubernetes/kubernetes_git.bb +++ b/recipes-containers/kubernetes/kubernetes_git.bb | |||
@@ -31,6 +31,7 @@ SRC_URI:append = " \ | |||
31 | file://0001-build-golang.sh-convert-remaining-go-calls-to-use.patch \ | 31 | file://0001-build-golang.sh-convert-remaining-go-calls-to-use.patch \ |
32 | file://0001-Makefile.generated_files-Fix-race-issue-for-installi.patch \ | 32 | file://0001-Makefile.generated_files-Fix-race-issue-for-installi.patch \ |
33 | file://cni-containerd-net.conflist \ | 33 | file://cni-containerd-net.conflist \ |
34 | file://k8s-init \ | ||
34 | " | 35 | " |
35 | 36 | ||
36 | DEPENDS += "rsync-native \ | 37 | DEPENDS += "rsync-native \ |
@@ -100,11 +101,16 @@ do_install() { | |||
100 | 101 | ||
101 | install -m 0644 ${WORKDIR}/git/release/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service ${D}${systemd_unitdir}/system/ | 102 | install -m 0644 ${WORKDIR}/git/release/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service ${D}${systemd_unitdir}/system/ |
102 | install -m 0644 ${WORKDIR}/git/release/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf ${D}${systemd_unitdir}/system/kubelet.service.d/ | 103 | install -m 0644 ${WORKDIR}/git/release/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf ${D}${systemd_unitdir}/system/kubelet.service.d/ |
104 | |||
105 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then | ||
106 | install -d "${D}${BIN_PREFIX}/bin" | ||
107 | install -m 755 "${WORKDIR}/k8s-init" "${D}${BIN_PREFIX}/bin" | ||
108 | fi | ||
103 | } | 109 | } |
104 | 110 | ||
105 | CNI_NETWORKING_FILES ?= "${WORKDIR}/cni-containerd-net.conflist" | 111 | CNI_NETWORKING_FILES ?= "${WORKDIR}/cni-containerd-net.conflist" |
106 | 112 | ||
107 | PACKAGES =+ "kubeadm kubectl kubelet kube-proxy ${PN}-misc" | 113 | PACKAGES =+ "kubeadm kubectl kubelet kube-proxy ${PN}-misc ${PN}-host" |
108 | 114 | ||
109 | ALLOW_EMPTY:${PN} = "1" | 115 | ALLOW_EMPTY:${PN} = "1" |
110 | INSANE_SKIP:${PN} += "ldflags already-stripped" | 116 | INSANE_SKIP:${PN} += "ldflags already-stripped" |
@@ -131,6 +137,10 @@ FILES:kubectl = "${bindir}/kubectl" | |||
131 | FILES:kube-proxy = "${bindir}/kube-proxy" | 137 | FILES:kube-proxy = "${bindir}/kube-proxy" |
132 | FILES:${PN}-misc = "${bindir}" | 138 | FILES:${PN}-misc = "${bindir}" |
133 | 139 | ||
140 | ALLOW_EMPTY:${PN}-host = "1" | ||
141 | FILE:${PN}-host = "${BIN_PREFIX}/bin/k8s-init" | ||
142 | RDEPENDS:${PN}-host = "${PN}" | ||
143 | |||
134 | RRECOMMENDS:${PN} = "\ | 144 | RRECOMMENDS:${PN} = "\ |
135 | kernel-module-xt-addrtype \ | 145 | kernel-module-xt-addrtype \ |
136 | kernel-module-xt-nat \ | 146 | kernel-module-xt-nat \ |