wangyang0918 commented on code in PR #155: URL: https://github.com/apache/flink-kubernetes-operator/pull/155#discussion_r844856310
########## docs/content/docs/operations/helm.md: ########## @@ -109,3 +109,107 @@ spec: skipCrds: true ... ``` + +## Advanced customization techniques +The Helm chart does not aim to provide configuration options for all the possible deployment scenarios of the Operator. There are use cases for injecting common tools and/or sidecars in most enterprise environments that simply cannot be covered by public Helm charts. + +Fortunately, [post rendering](https://helm.sh/docs/topics/advanced/#post-rendering) in Helm gives you the ability to manually manipulate manifests before they are installed on a Kubernetes cluster. This allows users to use tools like [kustomize](https://kustomize.io) to apply configuration changes without the need to fork public charts. + +The GitHub repository for the Operator contains a simple [example](https://github.com/apache/flink-kubernetes-operator/tree/main/examples/kustomize) on how to augment the Operator Deployment with a [fluent-bit](https://docs.fluentbit.io/manual) sidecar container and adjust container resources using `kustomize`. + +The example demonstrates that we can still use a `values.yaml` file to override the default Helm values for changing the log configuration, for example: + +```yaml + +operatorConfiguration: + ... + log4j2.properties: |+ + rootLogger.appenderRef.file.ref = LogFile + appender.file.name = LogFile + appender.file.type = File + appender.file.append = false + appender.file.fileName = ${sys:log.file} + appender.file.layout.type = PatternLayout + appender.file.layout.pattern = %d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %-60c %x - %m%n + +jvmArgs: + webhook: "-Dlog.file=/opt/flink/log/webhook.log -Xms256m -Xmx256m" + operator: "-Dlog.file=/opt/flink/log/operator.log -Xms2048m -Xmx2048m" +``` + +But we cannot ingest our fluent-bit sidecar for example unless we patch the deployment using `kustomize` + +```yaml +################################################################################ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +################################################################################ + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: not-important +spec: + template: + spec: + containers: + - name: flink-kubernetes-operator + volumeMounts: + - name: flink-log + mountPath: /opt/flink/log + resources: + requests: + memory: "2.5Gi" + cpu: "1000m" + limits: + memory: "2.5Gi" + cpu: "2000m" + - name: flink-webhook + volumeMounts: + - name: flink-log + mountPath: /opt/flink/log + resources: + requests: + memory: "0.5Gi" + cpu: "200m" + limits: + memory: "0.5Gi" + cpu: "500m" + - name: fluentbit + image: fluent/fluent-bit:1.8.12 + command: [ 'sh','-c','/fluent-bit/bin/fluent-bit -i tail -p path=/opt/flink/log/*.log -p multiline.parser=java -o stdout' ] Review Comment: The flink-kubernetes-operator could run normally now. But the `fluent` does not tail the logs correctly. Do I miss some thing? ``` wangyang-pc:flink-kubernetes-operator danrtsey.wy$ kubectl logs flink-kubernetes-operator-7c6b75b9bf-nrg9x -c fluentbit Fluent Bit v1.8.12 * Copyright (C) 2019-2021 The Fluent Bit Authors * Copyright (C) 2015-2018 Treasure Data * Fluent Bit is a CNCF sub-project under the umbrella of Fluentd * https://fluentbit.io [2022/04/07 07:54:58] [ info] [engine] started (pid=8) [2022/04/07 07:54:58] [ info] [storage] version=1.1.5, initializing... [2022/04/07 07:54:58] [ info] [storage] in-memory [2022/04/07 07:54:58] [ info] [storage] normal synchronization mode, checksum disabled, max_chunks_up=128 [2022/04/07 07:54:58] [ info] [cmetrics] version=0.2.2 [2022/04/07 07:54:58] [ info] [input:tail:tail.0] multiline core started [2022/04/07 07:54:58] [ info] [sp] stream processor started ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org