Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
728b337e
Commit
728b337e
authored
Jul 17, 2015
by
Robert Bailey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor the functions that generate auth for the kubelet and kubeproxy
and remove the insecure configuration now that GKE has plumbed through certificates.
parent
d28a6656
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
61 deletions
+15
-61
configure-vm.sh
cluster/gce/configure-vm.sh
+15
-61
No files found.
cluster/gce/configure-vm.sh
View file @
728b337e
...
@@ -331,22 +331,14 @@ function create-salt-master-auth() {
...
@@ -331,22 +331,14 @@ function create-salt-master-auth() {
fi
fi
}
}
# TODO(roberthbailey): Remove the insecure kubeconfig configuration files
# This should happen both on cluster initialization and node upgrades.
# once the certs are being plumbed through for GKE.
#
function
create-salt-node-auth
()
{
# - Uses CA_CERT, KUBELET_CERT, and KUBELET_KEY to generate a kubeconfig file
if
[[
!
-e
/srv/kubernetes/ca.crt
]]
;
then
# for the kubelet to securely connect to the apiserver.
if
[[
!
-z
"
${
CA_CERT
:-}
"
]]
&&
[[
!
-z
"
${
KUBELET_CERT
:-}
"
]]
&&
[[
!
-z
"
${
KUBELET_KEY
:-}
"
]]
;
then
function
create-salt-kubelet-auth
()
{
mkdir
-p
/srv/kubernetes
local
-r
kubelet_kubeconfig_file
=
"/srv/salt-overlay/salt/kubelet/kubeconfig"
(
umask
077
;
echo
"
${
CA_CERT
}
"
|
base64
-d
>
/srv/kubernetes/ca.crt
;
echo
"
${
KUBELET_CERT
}
"
|
base64
-d
>
/srv/kubernetes/kubelet.crt
;
echo
"
${
KUBELET_KEY
}
"
|
base64
-d
>
/srv/kubernetes/kubelet.key
)
fi
fi
kubelet_kubeconfig_file
=
"/srv/salt-overlay/salt/kubelet/kubeconfig"
if
[
!
-e
"
${
kubelet_kubeconfig_file
}
"
]
;
then
if
[
!
-e
"
${
kubelet_kubeconfig_file
}
"
]
;
then
mkdir
-p
/srv/salt-overlay/salt/kubelet
mkdir
-p
/srv/salt-overlay/salt/kubelet
if
[[
!
-z
"
${
CA_CERT
:-}
"
]]
&&
[[
!
-z
"
${
KUBELET_CERT
:-}
"
]]
&&
[[
!
-z
"
${
KUBELET_KEY
:-}
"
]]
;
then
(
umask
077
;
(
umask
077
;
cat
>
"
${
kubelet_kubeconfig_file
}
"
<<
EOF
cat
>
"
${
kubelet_kubeconfig_file
}
"
<<
EOF
apiVersion: v1
apiVersion: v1
...
@@ -368,34 +360,17 @@ contexts:
...
@@ -368,34 +360,17 @@ contexts:
current-context: service-account-context
current-context: service-account-context
EOF
EOF
)
)
else
(
umask
077
;
cat
>
"
${
kubelet_kubeconfig_file
}
"
<<
EOF
apiVersion: v1
kind: Config
users:
- name: kubelet
user:
token:
${
KUBELET_TOKEN
}
clusters:
- name: local
cluster:
insecure-skip-tls-verify: true
contexts:
- context:
cluster: local
user: kubelet
name: service-account-context
current-context: service-account-context
EOF
)
fi
fi
fi
}
kube_proxy_kubeconfig_file
=
"/srv/salt-overlay/salt/kube-proxy/kubeconfig"
# This should happen both on cluster initialization and node upgrades.
#
# - Uses the CA_CERT and KUBE_PROXY_TOKEN to generate a kubeconfig file for
# the kube-proxy to securely connect to the apiserver.
function
create-salt-kubeproxy-auth
()
{
local
-r
kube_proxy_kubeconfig_file
=
"/srv/salt-overlay/salt/kube-proxy/kubeconfig"
if
[
!
-e
"
${
kube_proxy_kubeconfig_file
}
"
]
;
then
if
[
!
-e
"
${
kube_proxy_kubeconfig_file
}
"
]
;
then
mkdir
-p
/srv/salt-overlay/salt/kube-proxy
mkdir
-p
/srv/salt-overlay/salt/kube-proxy
if
[[
!
-z
"
${
CA_CERT
:-}
"
]]
;
then
(
umask
077
;
(
umask
077
;
cat
>
"
${
kube_proxy_kubeconfig_file
}
"
<<
EOF
cat
>
"
${
kube_proxy_kubeconfig_file
}
"
<<
EOF
apiVersion: v1
apiVersion: v1
...
@@ -416,28 +391,6 @@ contexts:
...
@@ -416,28 +391,6 @@ contexts:
current-context: service-account-context
current-context: service-account-context
EOF
EOF
)
)
else
(
umask
077
;
cat
>
"
${
kube_proxy_kubeconfig_file
}
"
<<
EOF
apiVersion: v1
kind: Config
users:
- name: kube-proxy
user:
token:
${
KUBE_PROXY_TOKEN
}
clusters:
- name: local
cluster:
insecure-skip-tls-verify: true
contexts:
- context:
cluster: local
user: kube-proxy
name: service-account-context
current-context: service-account-context
EOF
)
fi
fi
fi
}
}
...
@@ -598,7 +551,8 @@ if [[ -z "${is_push}" ]]; then
...
@@ -598,7 +551,8 @@ if [[ -z "${is_push}" ]]; then
if
[[
"
${
KUBERNETES_MASTER
}
"
==
"true"
]]
;
then
if
[[
"
${
KUBERNETES_MASTER
}
"
==
"true"
]]
;
then
create-salt-master-auth
create-salt-master-auth
else
else
create-salt-node-auth
create-salt-kubelet-auth
create-salt-kubeproxy-auth
fi
fi
download-release
download-release
configure-salt
configure-salt
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment