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
9b0d8b97
Commit
9b0d8b97
authored
Jan 17, 2017
by
Shyam Jeedigunta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added RBAC for heapster in kubemark
parent
3aa29bca
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
3 deletions
+40
-3
heapster_template.json
test/kubemark/resources/heapster_template.json
+2
-2
heapster-binding.yaml
...fests/addons/kubemark-rbac-bindings/heapster-binding.yaml
+15
-0
start-kubemark.sh
test/kubemark/start-kubemark.sh
+23
-1
No files found.
test/kubemark/resources/heapster_template.json
View file @
9b0d8b97
...
@@ -44,7 +44,7 @@
...
@@ -44,7 +44,7 @@
"/heapster"
"/heapster"
],
],
"args"
:
[
"args"
:
[
"--source=kubernetes:https://{{MASTER_IP}}:443?inClusterConfig=0&useServiceAccount=0&auth=/kubeconfig/
kubelet
.kubeconfig"
"--source=kubernetes:https://{{MASTER_IP}}:443?inClusterConfig=0&useServiceAccount=0&auth=/kubeconfig/
heapster
.kubeconfig"
],
],
"volumeMounts"
:
[
"volumeMounts"
:
[
{
{
...
@@ -66,7 +66,7 @@
...
@@ -66,7 +66,7 @@
"/eventer"
"/eventer"
],
],
"args"
:
[
"args"
:
[
"--source=kubernetes:https://104.197.233.84:443?inClusterConfig=0&useServiceAccount=0&auth=/kubeconfig/
kubelet
.kubeconfig"
"--source=kubernetes:https://104.197.233.84:443?inClusterConfig=0&useServiceAccount=0&auth=/kubeconfig/
heapster
.kubeconfig"
],
],
"volumeMounts"
:
[
"volumeMounts"
:
[
{
{
...
...
test/kubemark/resources/manifests/addons/kubemark-rbac-bindings/heapster-binding.yaml
0 → 100644
View file @
9b0d8b97
# This is the role binding for the kubemark heapster.
apiVersion
:
rbac.authorization.k8s.io/v1alpha1
kind
:
ClusterRoleBinding
metadata
:
name
:
heapster-view-binding
labels
:
kubernetes.io/cluster-service
:
"
true"
roleRef
:
apiGroup
:
rbac.authorization.k8s.io
kind
:
ClusterRole
name
:
system:heapster
subjects
:
-
apiVersion
:
rbac/v1alpha1
kind
:
User
name
:
system:heapster
test/kubemark/start-kubemark.sh
View file @
9b0d8b97
...
@@ -133,6 +133,7 @@ gen-kube-bearertoken
...
@@ -133,6 +133,7 @@ gen-kube-bearertoken
create-certs
${
MASTER_IP
}
create-certs
${
MASTER_IP
}
KUBELET_TOKEN
=
$(
dd
if
=
/dev/urandom
bs
=
128
count
=
1 2>/dev/null |
base64
|
tr
-d
"=+/"
|
dd
bs
=
32
count
=
1 2>/dev/null
)
KUBELET_TOKEN
=
$(
dd
if
=
/dev/urandom
bs
=
128
count
=
1 2>/dev/null |
base64
|
tr
-d
"=+/"
|
dd
bs
=
32
count
=
1 2>/dev/null
)
KUBE_PROXY_TOKEN
=
$(
dd
if
=
/dev/urandom
bs
=
128
count
=
1 2>/dev/null |
base64
|
tr
-d
"=+/"
|
dd
bs
=
32
count
=
1 2>/dev/null
)
KUBE_PROXY_TOKEN
=
$(
dd
if
=
/dev/urandom
bs
=
128
count
=
1 2>/dev/null |
base64
|
tr
-d
"=+/"
|
dd
bs
=
32
count
=
1 2>/dev/null
)
HEAPSTER_TOKEN
=
$(
dd
if
=
/dev/urandom
bs
=
128
count
=
1 2>/dev/null |
base64
|
tr
-d
"=+/"
|
dd
bs
=
32
count
=
1 2>/dev/null
)
echo
"
${
CA_CERT_BASE64
}
"
|
base64
--decode
>
"
${
RESOURCE_DIRECTORY
}
/ca.crt"
echo
"
${
CA_CERT_BASE64
}
"
|
base64
--decode
>
"
${
RESOURCE_DIRECTORY
}
/ca.crt"
echo
"
${
KUBECFG_CERT_BASE64
}
"
|
base64
--decode
>
"
${
RESOURCE_DIRECTORY
}
/kubecfg.crt"
echo
"
${
KUBECFG_CERT_BASE64
}
"
|
base64
--decode
>
"
${
RESOURCE_DIRECTORY
}
/kubecfg.crt"
...
@@ -154,6 +155,7 @@ run-gcloud-compute-with-retries ssh --zone="${ZONE}" --project="${PROJECT}" "${M
...
@@ -154,6 +155,7 @@ run-gcloud-compute-with-retries ssh --zone="${ZONE}" --project="${PROJECT}" "${M
sudo bash -c
\"
echo
\"
${
KUBE_BEARER_TOKEN
}
,admin,admin
\"
> /etc/srv/kubernetes/known_tokens.csv
\"
&&
\
sudo bash -c
\"
echo
\"
${
KUBE_BEARER_TOKEN
}
,admin,admin
\"
> /etc/srv/kubernetes/known_tokens.csv
\"
&&
\
sudo bash -c
\"
echo
\"
${
KUBELET_TOKEN
}
,system:node:node-name,uid:kubelet,system:nodes
\"
>> /etc/srv/kubernetes/known_tokens.csv
\"
&&
\
sudo bash -c
\"
echo
\"
${
KUBELET_TOKEN
}
,system:node:node-name,uid:kubelet,system:nodes
\"
>> /etc/srv/kubernetes/known_tokens.csv
\"
&&
\
sudo bash -c
\"
echo
\"
${
KUBE_PROXY_TOKEN
}
,system:kube-proxy,uid:kube_proxy
\"
>> /etc/srv/kubernetes/known_tokens.csv
\"
&&
\
sudo bash -c
\"
echo
\"
${
KUBE_PROXY_TOKEN
}
,system:kube-proxy,uid:kube_proxy
\"
>> /etc/srv/kubernetes/known_tokens.csv
\"
&&
\
sudo bash -c
\"
echo
\"
${
HEAPSTER_TOKEN
}
,system:heapster,uid:heapster
\"
>> /etc/srv/kubernetes/known_tokens.csv
\"
&&
\
sudo bash -c
\"
echo
${
password
}
,admin,admin > /etc/srv/kubernetes/basic_auth.csv
\"
"
sudo bash -c
\"
echo
${
password
}
,admin,admin > /etc/srv/kubernetes/basic_auth.csv
\"
"
run-gcloud-compute-with-retries copy-files
--zone
=
"
${
ZONE
}
"
--project
=
"
${
PROJECT
}
"
\
run-gcloud-compute-with-retries copy-files
--zone
=
"
${
ZONE
}
"
--project
=
"
${
PROJECT
}
"
\
...
@@ -214,6 +216,25 @@ contexts:
...
@@ -214,6 +216,25 @@ contexts:
name: kubemark-context
name: kubemark-context
current-context: kubemark-context"
|
base64
|
tr
-d
"
\n\r
"
)
current-context: kubemark-context"
|
base64
|
tr
-d
"
\n\r
"
)
# Create kubeconfig for Heapster.
HEAPSTER_KUBECONFIG_CONTENTS
=
$(
echo
"apiVersion: v1
kind: Config
users:
- name: heapster
user:
token:
${
HEAPSTER_TOKEN
}
clusters:
- name: kubemark
cluster:
insecure-skip-tls-verify: true
server: https://
${
MASTER_IP
}
contexts:
- context:
cluster: kubemark
user: heapster
name: kubemark-context
current-context: kubemark-context"
|
base64
|
tr
-d
"
\n\r
"
)
KUBECONFIG_SECRET
=
"
${
RESOURCE_DIRECTORY
}
/kubeconfig_secret.json"
KUBECONFIG_SECRET
=
"
${
RESOURCE_DIRECTORY
}
/kubeconfig_secret.json"
cat
>
"
${
KUBECONFIG_SECRET
}
"
<<
EOF
cat
>
"
${
KUBECONFIG_SECRET
}
"
<<
EOF
{
{
...
@@ -225,7 +246,8 @@ cat > "${KUBECONFIG_SECRET}" << EOF
...
@@ -225,7 +246,8 @@ cat > "${KUBECONFIG_SECRET}" << EOF
"type": "Opaque",
"type": "Opaque",
"data": {
"data": {
"kubelet.kubeconfig": "
${
KUBELET_KUBECONFIG_CONTENTS
}
",
"kubelet.kubeconfig": "
${
KUBELET_KUBECONFIG_CONTENTS
}
",
"kubeproxy.kubeconfig": "
${
KUBEPROXY_KUBECONFIG_CONTENTS
}
"
"kubeproxy.kubeconfig": "
${
KUBEPROXY_KUBECONFIG_CONTENTS
}
",
"heapster.kubeconfig": "
${
HEAPSTER_KUBECONFIG_CONTENTS
}
"
}
}
}
}
EOF
EOF
...
...
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