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
2eb24f9a
Commit
2eb24f9a
authored
Feb 05, 2018
by
Daniel Kłobuszewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable scaling fluentd-gcp resources using ScalingPolicy.
See
https://github.com/justinsb/scaler
for more details about ScalingPolicy resource.
parent
aee2cff1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
134 additions
and
38 deletions
+134
-38
fluentd-gcp-ds.yaml
cluster/addons/fluentd-gcp/fluentd-gcp-ds.yaml
+0
-6
scaler-deployment.yaml
cluster/addons/fluentd-gcp/scaler-deployment.yaml
+34
-0
scaler-policy.yaml
cluster/addons/fluentd-gcp/scaler-policy.yaml
+13
-0
scaler-rbac.yaml
cluster/addons/fluentd-gcp/scaler-rbac.yaml
+48
-0
config-default.sh
cluster/gce/config-default.sh
+3
-3
config-test.sh
cluster/gce/config-test.sh
+3
-3
configure-helper.sh
cluster/gce/gci/configure-helper.sh
+33
-26
No files found.
cluster/addons/fluentd-gcp/fluentd-gcp-ds.yaml
View file @
2eb24f9a
...
...
@@ -31,12 +31,6 @@ spec:
env
:
-
name
:
FLUENTD_ARGS
value
:
--no-supervisor -q
resources
:
limits
:
memory
:
300Mi
requests
:
cpu
:
100m
memory
:
200Mi
volumeMounts
:
-
name
:
varlog
mountPath
:
/var/log
...
...
cluster/addons/fluentd-gcp/scaler-deployment.yaml
0 → 100644
View file @
2eb24f9a
apiVersion
:
apps/v1
kind
:
Deployment
metadata
:
name
:
fluentd-gcp-scaler
namespace
:
kube-system
labels
:
k8s-app
:
fluentd-gcp-scaler
version
:
v0.1
addonmanager.kubernetes.io/mode
:
Reconcile
spec
:
selector
:
matchLabels
:
k8s-app
:
fluentd-gcp-scaler
template
:
metadata
:
labels
:
k8s-app
:
fluentd-gcp-scaler
spec
:
serviceAccountName
:
fluentd-gcp-scaler
containers
:
-
name
:
fluentd-gcp-scaler
image
:
gcr.io/google-containers/fluentd-gcp-scaler:0.1
command
:
-
/scaler.sh
-
--ds-name=fluentd-gcp-v2.0.13
-
--scaling-policy=fluentd-gcp-scaling-policy
env
:
# Defaults, used if no overrides are found in fluentd-gcp-scaling-policy
-
name
:
CPU_REQUEST
value
:
100m
-
name
:
MEMORY_REQUEST
value
:
200Mi
-
name
:
MEMORY_LIMIT
value
:
300Mi
cluster/addons/fluentd-gcp/scaler-policy.yaml
0 → 100644
View file @
2eb24f9a
apiVersion
:
apiextensions.k8s.io/v1beta1
kind
:
CustomResourceDefinition
metadata
:
name
:
scalingpolicies.scalingpolicy.kope.io
labels
:
addonmanager.kubernetes.io/mode
:
Reconcile
spec
:
group
:
scalingpolicy.kope.io
version
:
v1alpha1
names
:
kind
:
ScalingPolicy
plural
:
scalingpolicies
scope
:
Namespaced
cluster/addons/fluentd-gcp/scaler-rbac.yaml
0 → 100644
View file @
2eb24f9a
apiVersion
:
v1
kind
:
ServiceAccount
metadata
:
name
:
fluentd-gcp-scaler
namespace
:
kube-system
labels
:
kubernetes.io/cluster-service
:
"
true"
addonmanager.kubernetes.io/mode
:
Reconcile
---
apiVersion
:
rbac.authorization.k8s.io/v1
kind
:
Role
metadata
:
name
:
system:fluentd-gcp-scaler
namespace
:
kube-system
labels
:
kubernetes.io/cluster-service
:
"
true"
addonmanager.kubernetes.io/mode
:
Reconcile
rules
:
-
apiGroups
:
-
"
extensions"
resources
:
-
daemonsets
verbs
:
-
get
-
patch
-
apiGroups
:
-
"
scalingpolicy.kope.io"
resources
:
-
scalingpolicies
verbs
:
-
get
---
apiVersion
:
rbac.authorization.k8s.io/v1
kind
:
RoleBinding
metadata
:
name
:
fluentd-gcp-scaler-binding
namespace
:
kube-system
labels
:
kubernetes.io/cluster-service
:
"
true"
addonmanager.kubernetes.io/mode
:
Reconcile
roleRef
:
apiGroup
:
rbac.authorization.k8s.io
kind
:
Role
name
:
system:fluentd-gcp-scaler
subjects
:
-
kind
:
ServiceAccount
name
:
fluentd-gcp-scaler
namespace
:
kube-system
cluster/gce/config-default.sh
View file @
2eb24f9a
...
...
@@ -353,9 +353,9 @@ if [[ -n "${LOGROTATE_MAX_SIZE:-}" ]]; then
fi
# Fluentd requirements
FLUENTD_GCP_MEMORY_LIMIT
=
"
${
FLUENTD_GCP_MEMORY_LIMIT
:-
300Mi
}
"
FLUENTD_GCP_CPU_REQUEST
=
"
${
FLUENTD_GCP_CPU_REQUEST
:-
100m
}
"
FLUENTD_GCP_MEMORY_REQUEST
=
"
${
FLUENTD_GCP_MEMORY_REQUEST
:-
200Mi
}
"
FLUENTD_GCP_MEMORY_LIMIT
=
"
${
FLUENTD_GCP_MEMORY_LIMIT
:-}
"
FLUENTD_GCP_CPU_REQUEST
=
"
${
FLUENTD_GCP_CPU_REQUEST
:-}
"
FLUENTD_GCP_MEMORY_REQUEST
=
"
${
FLUENTD_GCP_MEMORY_REQUEST
:-}
"
# Heapster requirements
HEAPSTER_GCP_BASE_MEMORY
=
"
${
HEAPSTER_GCP_BASE_MEMORY
:-
140Mi
}
"
...
...
cluster/gce/config-test.sh
View file @
2eb24f9a
...
...
@@ -388,9 +388,9 @@ if [[ -n "${LOGROTATE_MAX_SIZE:-}" ]]; then
fi
# Fluentd requirements
FLUENTD_GCP_MEMORY_LIMIT
=
"
${
FLUENTD_GCP_MEMORY_LIMIT
:-
300Mi
}
"
FLUENTD_GCP_CPU_REQUEST
=
"
${
FLUENTD_GCP_CPU_REQUEST
:-
100m
}
"
FLUENTD_GCP_MEMORY_REQUEST
=
"
${
FLUENTD_GCP_MEMORY_REQUEST
:-
200Mi
}
"
FLUENTD_GCP_MEMORY_LIMIT
=
"
${
FLUENTD_GCP_MEMORY_LIMIT
:-}
"
FLUENTD_GCP_CPU_REQUEST
=
"
${
FLUENTD_GCP_CPU_REQUEST
:-}
"
FLUENTD_GCP_MEMORY_REQUEST
=
"
${
FLUENTD_GCP_MEMORY_REQUEST
:-}
"
# Heapster requirements
HEAPSTER_GCP_BASE_MEMORY
=
"
${
HEAPSTER_GCP_BASE_MEMORY
:-
140Mi
}
"
...
...
cluster/gce/gci/configure-helper.sh
View file @
2eb24f9a
...
...
@@ -1979,50 +1979,57 @@ function copy-manifests {
chmod
644
"
${
dst_dir
}
"
/
*
}
# Fluentd
manifest is modified using kubectl, which may not be available at
# this point. Run this as a background process.
# Fluentd
resources are modified using ScalingPolicy CR, which may not be
#
available at
this point. Run this as a background process.
function
wait-for-apiserver-and-update-fluentd
{
local
-r
fluentd_gcp_yaml
=
"
${
1
}
"
local
modifying_flags
=
""
local
any_overrides
=
false
if
[[
-n
"
${
FLUENTD_GCP_MEMORY_LIMIT
:-}
"
]]
;
then
modifying_flags
=
"
${
modifying_flags
}
--limits=memory=
${
FLUENTD_GCP_MEMORY_LIMIT
}
"
any_overrides
=
true
fi
local
request_resources
=
""
if
[[
-n
"
${
FLUENTD_GCP_CPU_REQUEST
:-}
"
]]
;
then
request_resources
=
"cpu=
${
FLUENTD_GCP_CPU_REQUEST
}
"
any_overrides
=
true
fi
if
[[
-n
"
${
FLUENTD_GCP_MEMORY_REQUEST
:-}
"
]]
;
then
if
[[
-n
"
${
request_resources
}
"
]]
;
then
request_resources
=
"
${
request_resources
}
,"
fi
request_resources
=
"memory=
${
FLUENTD_GCP_MEMORY_REQUEST
}
"
any_overrides
=
true
fi
if
[[
-n
"
${
request_resources
}
"
]]
;
then
modifying_flags
=
"
${
modifying_flags
}
--requests=
${
request_resources
}
"
if
!
$any_overrides
;
then
# Nothing to do here.
exit
fi
until
kubectl get nodes
# Wait until ScalingPolicy CRD is in place.
until
kubectl get scalingpolicies
do
sleep
10
done
local
-r
temp_fluentd_gcp_yaml
=
"
${
fluentd_gcp_yaml
}
.tmp"
if
kubectl
set
resources
--dry-run
--local
-f
${
fluentd_gcp_yaml
}
${
modifying_flags
}
\
--containers
=
fluentd-gcp
-o
yaml
>
${
temp_fluentd_gcp_yaml
}
;
then
mv
${
temp_fluentd_gcp_yaml
}
${
fluentd_gcp_yaml
}
else
(
echo
"Failed to update fluentd resources. Used manifest:"
&&
cat
${
temp_fluentd_gcp_yaml
}
)
>
&2
rm
${
temp_fluentd_gcp_yaml
}
fi
# Single-shot, not managed by addon manager. Can be later modified or removed
# at will.
cat
<<
EOF
| kubectl apply -f -
apiVersion: scalingpolicy.kope.io/v1alpha1
kind: ScalingPolicy
metadata:
name: fluentd-gcp-scaling-policy
namespace: kube-system
spec:
containers:
- name: fluentd-gcp
resources:
requests:
- resource: cpu
base:
${
FLUENTD_GCP_CPU_REQUEST
:-}
- resource: memory
base:
${
FLUENTD_GCP_MEMORY_REQUEST
:-}
limits:
- resource: memory
base:
${
FLUENTD_GCP_MEMORY_LIMIT
:-}
EOF
}
# Trigger background process that will ultimately update fluentd resource
# requirements.
function
start-fluentd-resource-update
{
local
-r
fluentd_gcp_yaml
=
"
${
1
}
"
wait-for-apiserver-and-update-fluentd
${
fluentd_gcp_yaml
}
&
wait-for-apiserver-and-update-fluentd &
}
# Updates parameters in yaml file for prometheus-to-sd configuration, or
...
...
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