mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 01:59:07 +00:00
kubernetes: Expose each node's ssh port on the host starting from 2222
Port base is configurable (via $KUBE_PORT_BASE envvar). Master uses this and nodes use subsequent ports. Check that the node number is numeric so we can add them to things, but avoid worker node 0 since the port will clash with master. Signed-off-by: Ian Campbell <ian.campbell@docker.com>
This commit is contained in:
parent
ce35fea83e
commit
2cfac0e8bb
@ -1,11 +1,25 @@
|
||||
#!/bin/bash -eu
|
||||
: ${KUBE_PORT_BASE:=2222}
|
||||
if [ $# -eq 0 ] ; then
|
||||
img="kube-master"
|
||||
port=${KUBE_PORT_BASE}
|
||||
data=""
|
||||
state="kube-master-state"
|
||||
elif [ $# -gt 1 ] ; then
|
||||
case $1 in
|
||||
''|*[!0-9]*)
|
||||
echo "Node number must be a number"
|
||||
exit 1
|
||||
;;
|
||||
0)
|
||||
echo "Node number must be greater than 0"
|
||||
exit 1
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
img="kube-node"
|
||||
name="node-${1}"
|
||||
port=$((${KUBE_PORT_BASE} + $1))
|
||||
shift
|
||||
data="${*}"
|
||||
state="kube-${name}-state"
|
||||
@ -19,4 +33,4 @@ else
|
||||
fi
|
||||
set -x
|
||||
rm -rf "${state}"
|
||||
../../bin/linuxkit run -cpus 2 -mem 4096 -state "${state}" -disk size=4G -data "${data}" "${img}"
|
||||
../../bin/linuxkit run -publish $port:22 -cpus 2 -mem 4096 -state "${state}" -disk size=4G -data "${data}" "${img}"
|
||||
|
Loading…
Reference in New Issue
Block a user