fix create-kubelet-kubeconfig.

1. keep function signature consistent.
implementations of the create-kubelet-kubeconfig function take an apiserver address as the first argument and the destination as the second argument.
2. remove duplicate file name(/kubelet.kubeconfig) in --kubeconfig=${KUBELET_KUBECONFIG}/kubelet.kubeconfig
pull/8/head
isaacdong 2018-08-10 16:07:49 +08:00
parent 28b2b21287
commit ece7c52bc3
1 changed files with 4 additions and 3 deletions

View File

@ -55,8 +55,9 @@ function run {
} }
# Creates a kubeconfig file for the kubelet. # Creates a kubeconfig file for the kubelet.
# Args: destination file path # Args: the IP address of the API server (e.g. "http://localhost:8080"), destination file path
function create-kubelet-kubeconfig() { function create-kubelet-kubeconfig() {
#local api_addr="${1}"
local destination="${2}" local destination="${2}"
if [[ -z "${destination}" ]]; then if [[ -z "${destination}" ]]; then
echo "Must provide destination path to create Kubelet kubeconfig file!" echo "Must provide destination path to create Kubelet kubeconfig file!"
@ -85,7 +86,7 @@ EOF
function create_cluster { function create_cluster {
echo "Creating a local cluster:" echo "Creating a local cluster:"
echo -e -n "\tStarting kubelet..." echo -e -n "\tStarting kubelet..."
create-kubelet-kubeconfig "${KUBELET_KUBECONFIG}" create-kubelet-kubeconfig "http://localhost:8080" "${KUBELET_KUBECONFIG}"
run "docker run \ run "docker run \
--volume=/:/rootfs:ro \ --volume=/:/rootfs:ro \
--volume=/sys:/sys:ro \ --volume=/sys:/sys:ro \
@ -103,7 +104,7 @@ function create_cluster {
--containerized \ --containerized \
--hostname-override="127.0.0.1" \ --hostname-override="127.0.0.1" \
--address="0.0.0.0" \ --address="0.0.0.0" \
--kubeconfig=${KUBELET_KUBECONFIG}/kubelet.kubeconfig \ --kubeconfig=${KUBELET_KUBECONFIG} \
--pod-manifest-path=/etc/kubernetes/manifests \ --pod-manifest-path=/etc/kubernetes/manifests \
--allow-privileged=true \ --allow-privileged=true \
--cluster-dns=10.0.0.10 \ --cluster-dns=10.0.0.10 \