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
b6b8056a
Commit
b6b8056a
authored
Jul 23, 2015
by
Vish Kannan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11742 from jszczepkowski/scaler-up
Optional creation of nodes autoscaler for GCE.
parents
c29a88dc
38085199
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
0 deletions
+39
-0
config-default.sh
cluster/gce/config-default.sh
+9
-0
config-test.sh
cluster/gce/config-test.sh
+9
-0
util.sh
cluster/gce/util.sh
+21
-0
No files found.
cluster/gce/config-default.sh
View file @
b6b8056a
...
@@ -74,6 +74,15 @@ DNS_SERVER_IP="10.0.0.10"
...
@@ -74,6 +74,15 @@ DNS_SERVER_IP="10.0.0.10"
DNS_DOMAIN
=
"cluster.local"
DNS_DOMAIN
=
"cluster.local"
DNS_REPLICAS
=
1
DNS_REPLICAS
=
1
# Optional: Create autoscaler for cluster's nodes.
# NOT WORKING YET!
ENABLE_NODE_AUTOSCALER
=
"
${
KUBE_ENABLE_NODE_AUTOSCALER
:-
false
}
"
if
[[
"
${
ENABLE_NODE_AUTOSCALER
}
"
==
"true"
]]
;
then
AUTOSCALER_MIN_NODES
=
"
${
KUBE_AUTOSCALER_MIN_NODES
:-
1
}
"
AUTOSCALER_MAX_NODES
=
"
${
KUBE_AUTOSCALER_MAX_NODES
:-${
NUM_MINIONS
}}
"
TARGET_NODE_UTILIZATION
=
"
${
KUBE_TARGET_NODE_UTILIZATION
:-
0
.7
}
"
fi
# Admission Controllers to invoke prior to persisting objects in cluster
# Admission Controllers to invoke prior to persisting objects in cluster
ADMISSION_CONTROL
=
NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota
ADMISSION_CONTROL
=
NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota
...
...
cluster/gce/config-test.sh
View file @
b6b8056a
...
@@ -72,6 +72,15 @@ DNS_SERVER_IP="10.0.0.10"
...
@@ -72,6 +72,15 @@ DNS_SERVER_IP="10.0.0.10"
DNS_DOMAIN
=
"cluster.local"
DNS_DOMAIN
=
"cluster.local"
DNS_REPLICAS
=
1
DNS_REPLICAS
=
1
# Optional: Create autoscaler for cluster's nodes.
# NOT WORKING YET!
ENABLE_NODE_AUTOSCALER
=
"
${
KUBE_ENABLE_NODE_AUTOSCALER
:-
false
}
"
if
[[
"
${
ENABLE_NODE_AUTOSCALER
}
"
==
"true"
]]
;
then
AUTOSCALER_MIN_NODES
=
"
${
KUBE_AUTOSCALER_MIN_NODES
:-
1
}
"
AUTOSCALER_MAX_NODES
=
"
${
KUBE_AUTOSCALER_MAX_NODES
:-${
NUM_MINIONS
}}
"
TARGET_NODE_UTILIZATION
=
"
${
KUBE_TARGET_NODE_UTILIZATION
:-
0
.7
}
"
fi
ADMISSION_CONTROL
=
NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota
ADMISSION_CONTROL
=
NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota
# Optional: if set to true kube-up will automatically check for existing resources and clean them up.
# Optional: if set to true kube-up will automatically check for existing resources and clean them up.
...
...
cluster/gce/util.sh
View file @
b6b8056a
...
@@ -708,6 +708,18 @@ function kube-up {
...
@@ -708,6 +708,18 @@ function kube-up {
detect-minion-names
detect-minion-names
detect-master
detect-master
# Create autoscaler for nodes if requested
if
[[
"
${
ENABLE_NODE_AUTOSCALER
}
"
==
"true"
]]
;
then
METRICS
=
""
METRICS+
=
"--custom-metric-utilization metric=custom.cloudmonitoring.googleapis.com/kubernetes.io/cpu/node_utilization,"
METRICS+
=
"utilization-target=
${
TARGET_NODE_UTILIZATION
}
,utilization-target-type=GAUGE "
METRICS+
=
"--custom-metric-utilization metric=custom.cloudmonitoring.googleapis.com/kubernetes.io/memory/node_utilization,"
METRICS+
=
"utilization-target=
${
TARGET_NODE_UTILIZATION
}
,utilization-target-type=GAUGE "
echo
"Creating node autoscaler."
gcloud preview autoscaler
--zone
"
${
ZONE
}
"
create
"
${
NODE_INSTANCE_PREFIX
}
-autoscaler"
--target
"
${
NODE_INSTANCE_PREFIX
}
-group"
\
--min-num-replicas
"
${
AUTOSCALER_MIN_NODES
}
"
--max-num-replicas
"
${
AUTOSCALER_MAX_NODES
}
"
${
METRICS
}
||
true
fi
echo
"Waiting for cluster initialization."
echo
"Waiting for cluster initialization."
echo
echo
echo
" This will continually check to see if the API for kubernetes is reachable."
echo
" This will continually check to see if the API for kubernetes is reachable."
...
@@ -769,6 +781,15 @@ function kube-down {
...
@@ -769,6 +781,15 @@ function kube-down {
echo
"Bringing down cluster"
echo
"Bringing down cluster"
set
+e
# Do not stop on error
set
+e
# Do not stop on error
# Delete autoscaler for nodes if present.
local
autoscaler
autoscaler
=(
$(
gcloud preview autoscaler
--zone
"
${
ZONE
}
"
list
\
|
awk
'NR >= 2 { print $1 }'
\
|
grep
"
${
NODE_INSTANCE_PREFIX
}
-autoscaler"
)
)
if
[[
"
${
autoscaler
:-}
"
!=
""
]]
;
then
gcloud preview autoscaler
--zone
"
${
ZONE
}
"
delete
"
${
NODE_INSTANCE_PREFIX
}
-autoscaler"
fi
# Get the name of the managed instance group template before we delete the
# Get the name of the managed instance group template before we delete the
# managed instange group. (The name of the managed instnace group template may
# managed instange group. (The name of the managed instnace group template may
# change during a cluster upgrade.)
# change during a cluster upgrade.)
...
...
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