Changing DaemonSet parameters
只需两步:
1、kubectl get xxx > xxx.yaml获取当前yaml;
2、kubectl replace -f xxx.yaml更新;
When you have the Stackdriver LoggingDaemonSetin your cluster, you can just modify thetemplatefield in its spec, daemonset controller will update the pods for you. For example, let’s assume you’ve just installed the Stackdriver Logging as described above. Now you want to change the memory limit to give fluentd more memory to safely process more logs.
Get the spec ofDaemonSetrunning in your cluster:
kubectl get ds fluentd-gcp-v2.0 --namespace kube-system -o yaml > fluentd-gcp-ds.yaml
Then edit resource requirements in the spec file and update theDaemonSetobject in the apiserver using the following command:
kubectl replace -f fluentd-gcp-ds.yaml
After some time, Stackdriver Logging agent pods will be restarted with the new configuration
但是,更新configMap就没那么简单了。
配过fluentd的都知道,comfigMap对象是配置fluentd重要的神器,它能配置fluentd镜像的配置文件,而不用修改镜像。
Fluentd configuration is stored in theConfigMapobject. It is effectively a set of configuration files that are merged together. You can learn about fluentd configuration on theofficial site.
Imagine you want to add a new parsing logic to the configuration, so that fluentd can understand default Python logging format. An appropriate fluentd filter looks similar to this:
type parser
format /^(?\w):(?\w):(?.*)/
reserve_data true
suppress_parse_error_log true
key_name log
UpdatingConfigMapin the apiserver is more complicated than updatingDaemonSet.It’s better to considerConfigMapto be immutable. Then, in order to update the configuration, you should createConfigMapwith a new name and then changeDaemonSetto point to it usingguide above.
https://kubernetes.io/docs/tasks/debug-application-cluster/logging-stackdriver/