mirror of
git://git.yoctoproject.org/meta-virtualization.git
synced 2025-07-05 05:15:25 +02:00
k8s: test init script
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
This commit is contained in:
parent
9c1f90d46b
commit
183da8b15e
28
recipes-containers/kubernetes/kubernetes/k8s-init
Normal file
28
recipes-containers/kubernetes/kubernetes/k8s-init
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Copyright (C) 2021 Bruce Ashfield
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
# cleanup the iptables
|
||||||
|
cp /etc/sysconfig/iptables /etc/sysconfig/iptables.ORIG && iptables --flush && iptables --flush && iptables-save > /etc/sysconfig/iptables
|
||||||
|
systemctl restart iptables.service
|
||||||
|
|
||||||
|
# Load/Enable br_netfilter kernel module
|
||||||
|
modprobe br_netfilter
|
||||||
|
modprobe overlay
|
||||||
|
|
||||||
|
echo '1' > /proc/sys/net/bridge/bridge-nf-call-iptables
|
||||||
|
echo '1' > /proc/sys/net/bridge/bridge-nf-call-ip6tables
|
||||||
|
echo 'net.bridge.bridge-nf-call-iptables=1' >> /etc/sysctl.d/k8s.conf
|
||||||
|
echo 'net.bridge.bridge-nf-call-ip6tables=1' >> /etc/sysctl.d/k8s.conf
|
||||||
|
echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.d/k8s.conf
|
||||||
|
|
||||||
|
systemctl restart systemd-sysctl.service
|
||||||
|
|
||||||
|
kubeadm init
|
||||||
|
|
||||||
|
# Copy the cluster configuration to the regular users home directory
|
||||||
|
mkdir -p $HOME/.kube
|
||||||
|
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
|
||||||
|
chown $(id -u):$(id -g) $HOME/.kube/config
|
|
@ -31,6 +31,7 @@ SRC_URI:append = " \
|
||||||
file://0001-build-golang.sh-convert-remaining-go-calls-to-use.patch \
|
file://0001-build-golang.sh-convert-remaining-go-calls-to-use.patch \
|
||||||
file://0001-Makefile.generated_files-Fix-race-issue-for-installi.patch \
|
file://0001-Makefile.generated_files-Fix-race-issue-for-installi.patch \
|
||||||
file://cni-containerd-net.conflist \
|
file://cni-containerd-net.conflist \
|
||||||
|
file://k8s-init \
|
||||||
"
|
"
|
||||||
|
|
||||||
DEPENDS += "rsync-native \
|
DEPENDS += "rsync-native \
|
||||||
|
@ -100,11 +101,16 @@ do_install() {
|
||||||
|
|
||||||
install -m 0644 ${WORKDIR}/git/release/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service ${D}${systemd_unitdir}/system/
|
install -m 0644 ${WORKDIR}/git/release/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service ${D}${systemd_unitdir}/system/
|
||||||
install -m 0644 ${WORKDIR}/git/release/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf ${D}${systemd_unitdir}/system/kubelet.service.d/
|
install -m 0644 ${WORKDIR}/git/release/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf ${D}${systemd_unitdir}/system/kubelet.service.d/
|
||||||
|
|
||||||
|
if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
|
||||||
|
install -d "${D}${BIN_PREFIX}/bin"
|
||||||
|
install -m 755 "${WORKDIR}/k8s-init" "${D}${BIN_PREFIX}/bin"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
CNI_NETWORKING_FILES ?= "${WORKDIR}/cni-containerd-net.conflist"
|
CNI_NETWORKING_FILES ?= "${WORKDIR}/cni-containerd-net.conflist"
|
||||||
|
|
||||||
PACKAGES =+ "kubeadm kubectl kubelet kube-proxy ${PN}-misc"
|
PACKAGES =+ "kubeadm kubectl kubelet kube-proxy ${PN}-misc ${PN}-host"
|
||||||
|
|
||||||
ALLOW_EMPTY:${PN} = "1"
|
ALLOW_EMPTY:${PN} = "1"
|
||||||
INSANE_SKIP:${PN} += "ldflags already-stripped"
|
INSANE_SKIP:${PN} += "ldflags already-stripped"
|
||||||
|
@ -131,6 +137,10 @@ FILES:kubectl = "${bindir}/kubectl"
|
||||||
FILES:kube-proxy = "${bindir}/kube-proxy"
|
FILES:kube-proxy = "${bindir}/kube-proxy"
|
||||||
FILES:${PN}-misc = "${bindir}"
|
FILES:${PN}-misc = "${bindir}"
|
||||||
|
|
||||||
|
ALLOW_EMPTY:${PN}-host = "1"
|
||||||
|
FILE:${PN}-host = "${BIN_PREFIX}/bin/k8s-init"
|
||||||
|
RDEPENDS:${PN}-host = "${PN}"
|
||||||
|
|
||||||
RRECOMMENDS:${PN} = "\
|
RRECOMMENDS:${PN} = "\
|
||||||
kernel-module-xt-addrtype \
|
kernel-module-xt-addrtype \
|
||||||
kernel-module-xt-nat \
|
kernel-module-xt-nat \
|
||||||
|
|
Loading…
Reference in New Issue
Block a user