forked from kubernetes/kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request kubernetes#15 from FujitsuEnablingSoftwareTechnolo…
…gyGmbH/hyperkube-install Hyperkube install
- Loading branch information
Showing
2 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/bin/bash | ||
node_type=$1 | ||
master_IP=$2 | ||
node_IP=$3 | ||
pause_image=${4:-gcr.io/google_containers/pause:2.0} | ||
|
||
if [ "$node_type" != "master" ] && [ "$node_type" != "minion" ]; then | ||
echo "Error: expected 'master' or 'minion' as argument" | ||
exit 1 | ||
fi | ||
|
||
if [ -z $master_IP ]; then | ||
echo "Error: IP of the master node not specified" | ||
exit 1 | ||
fi | ||
|
||
if [ -z $node_IP ]; then | ||
echo "Error: IP of the currently provisioned node is not specified" | ||
exit 1 | ||
fi | ||
|
||
# copy cni | ||
cp -R /opt/cni /hostfs/opt | ||
cp /usr/bin/nsenter /hostfs/usr/bin | ||
|
||
# copy cni configuration | ||
mkdir -p /hostfs/etc/cni | ||
cp -R /etc/cni/net.d /hostfs/etc/cni | ||
|
||
# copy hyperkube binary | ||
cp /hyperkube /hostfs/usr/bin/ | ||
|
||
if [ "$node_type" == "master" ]; then | ||
# clean up old configuration | ||
mkdir -p /hostfs/etc/kubernetes/manifests | ||
mkdir -p /hostfs/etc/kubernetes/addons | ||
|
||
# copy master components and addons | ||
cp /etc/kubernetes/manifests-multi/master-multi.json /hostfs/etc/kubernetes/manifests/ | ||
cp /etc/kubernetes/manifests-multi/addon-manager.json /hostfs/etc/kubernetes/manifests/ | ||
cp -R /etc/kubernetes/addons /hostfs/etc/kubernetes | ||
fi | ||
|
||
cat <<EOF >/hostfs/etc/systemd/system/kubelet.service | ||
[Unit] | ||
Description=Kubernetes Kubelet | ||
Documentation=https://github.com/kubernetes/kubernetes | ||
[Service] | ||
ExecStartPre=/usr/bin/mkdir -p /etc/kubernetes/manifests | ||
ExecStart=/usr/bin/hyperkube kubelet \\ | ||
--allow-privileged=true \\ | ||
--hostname-override=${node_IP} \\ | ||
--address=0.0.0.0 \\ | ||
--api-servers=http://${master_IP}:8080 \\ | ||
--config=/etc/kubernetes/manifests \\ | ||
--cluster-dns=10.0.0.10 \\ | ||
--cluster-domain=cluster.local \\ | ||
--pod-infra-container-image=${pause_image} \\ | ||
--network-plugin=cni \\ | ||
--network-plugin-dir=/etc/cni/net.d \\ | ||
--v=2 | ||
Restart=on-failure | ||
RestartSec=5 | ||
[Install] | ||
WantedBy=multi-user.target | ||
EOF |