Configuration

Configuration #

Specifying Operator Configuration #

The operator allows users to specify default configuration that will be shared by the Flink operator itself and the Flink deployments.

These configuration files are mounted externally via ConfigMaps. The Configuration files with default values are shipped in the Helm chart. It is recommended to review and adjust them if needed in the values.yaml file before deploying the Operator in production environments.

To append to the default configuration, define the flink-conf.yaml key in the defaultConfiguration section of the Helm values.yaml file:

defaultConfiguration:
  create: true
  # Set append to false to replace configuration files
  append: true
  flink-conf.yaml: |+
    # Flink Config Overrides
    kubernetes.operator.metrics.reporter.slf4j.factory.class: org.apache.flink.metrics.slf4j.Slf4jReporterFactory
    kubernetes.operator.metrics.reporter.slf4j.interval: 5 MINUTE

    kubernetes.operator.reconcile.interval: 15 s
    kubernetes.operator.observer.progress-check.interval: 5 s

To learn more about metrics and logging configuration please refer to the dedicated docs page.

Dynamic Operator Configuration #

The Kubernetes operator supports dynamic config changes through the operator ConfigMaps. Dynamic operator configuration is enabled by default, and can be disabled by setting kubernetes.operator.dynamic.config.enabled to false. Time interval for checking dynamic config changes is specified by kubernetes.operator.dynamic.config.check.interval of which default value is 5 minutes.

Verify whether dynamic operator configuration updates is enabled via the deploy/flink-kubernetes-operator log has:

2022-05-28 13:08:29,222 o.a.f.k.o.c.FlinkConfigManager [INFO ] Enabled dynamic config updates, checking config changes every PT5M

To change config values dynamically the ConfigMap can be directly edited via kubectl patch or kubectl edit command. For example to change the reschedule interval you can override kubernetes.operator.reconcile.interval.

Verify whether the config value of kubernetes.operator.reconcile.interval is updated to 30 seconds via the deploy/flink-kubernetes-operator log has:

2022-05-28 13:08:30,115 o.a.f.k.o.c.FlinkConfigManager [INFO ] Updating default configuration to {kubernetes.operator.reconcile.interval=PT30S}

Leader Election and High Availability #

The operator supports high availability through leader election and standby operator instances. To enable leader election you need to add the following two mandatory operator configuration parameters.

kubernetes.operator.leader-election.enabled: true
kubernetes.operator.leader-election.lease-name: flink-operator-lease

Lease name must be unique in the current lease namespace. For other more advanced config parameters please refer to the configuration reference.

Once you enabled leader election you can increase the replicas for the operator Deployment using the Helm chart to enable high availability.

Operator Configuration Reference #

System Configuration #

General operator system configuration. Cannot be overridden on a per-resource basis.

Key Default Type Description
kubernetes.operator.dynamic.namespaces.enabled
false Boolean Enables dynamic change of watched/monitored namespaces.
kubernetes.operator.exception.field.max.length
2048 Integer Maximum length of each exception field including stack trace to be included in CR status error field.
kubernetes.operator.exception.stacktrace.enabled
false Boolean Enable exception stacktrace to be included in CR status error field.
kubernetes.operator.exception.stacktrace.max.length
2048 Integer Maximum length of stacktrace to be included in CR status error field.
kubernetes.operator.exception.throwable.list.max.count
2 Integer Maximum number of throwable to be included in CR status error field.
kubernetes.operator.flink.client.cancel.timeout
1 min Duration The timeout for the reconciler to wait for flink to cancel job.
kubernetes.operator.flink.client.timeout
10 s Duration The timeout for the observer to wait the flink rest client to return.
kubernetes.operator.leader-election.enabled
false Boolean Enable leader election for the operator to allow running standby instances.
kubernetes.operator.leader-election.lease-duration
15 s Duration Leader election lease duration.
kubernetes.operator.leader-election.lease-name
(none) String Leader election lease name, must be unique for leases in the same namespace.
kubernetes.operator.leader-election.renew-deadline
10 s Duration Leader election renew deadline.
kubernetes.operator.leader-election.retry-period
2 s Duration Leader election retry period.
kubernetes.operator.reconcile.interval
1 min Duration The interval for the controller to reschedule the reconcile process.
kubernetes.operator.reconcile.parallelism
10 Integer The maximum number of threads running the reconciliation loop. Use -1 for infinite.
kubernetes.operator.resource.cleanup.timeout
1 min Duration The timeout for the resource clean up to wait for flink to shutdown cluster.
kubernetes.operator.retry.initial.interval
5 s Duration Initial interval of automatic reconcile retries on recoverable errors.
kubernetes.operator.retry.interval.multiplier
2.0 Double Interval multiplier of automatic reconcile retries on recoverable errors.
kubernetes.operator.retry.max.attempts
10 Integer Max attempts of automatic reconcile retries on recoverable errors.
kubernetes.operator.user.artifacts.base.dir
"/opt/flink/artifacts" String The base dir to put the session job artifacts.
kubernetes.operator.watched.namespaces
"JOSDK_ALL_NAMESPACES" String Comma separated list of namespaces the operator monitors for custom resources.

Resource/User Configuration #

These options can be configured on both an operator and a per-resource level. When set under spec.flinkConfiguration for the Flink resources it will override the default value provided in the operator default configuration (flink-conf.yaml).

Key Default Type Description
kubernetes.operator.cluster.health-check.checkpoint-progress.enabled
false Boolean Whether to enable checkpoint progress health check for clusters.
kubernetes.operator.cluster.health-check.checkpoint-progress.window
5 min Duration If no checkpoints are completed within the defined time window, the job is considered unhealthy. This must be bigger than checkpointing interval.
kubernetes.operator.cluster.health-check.enabled
false Boolean Whether to enable health check for clusters.
kubernetes.operator.cluster.health-check.restarts.threshold
64 Integer The threshold which is checked against job restart count within a configured window. If the restart count is reaching the threshold then full cluster restart is initiated.
kubernetes.operator.cluster.health-check.restarts.window
2 min Duration The duration of the time window where job restart count measured.
kubernetes.operator.deployment.readiness.timeout
5 min Duration The timeout for deployments to become ready/stable before being rolled back if rollback is enabled.
kubernetes.operator.deployment.rollback.enabled
false Boolean Whether to enable rolling back failed deployment upgrades.
kubernetes.operator.jm-deployment-recovery.enabled
true Boolean Whether to enable recovery of missing/deleted jobmanager deployments.
kubernetes.operator.jm-deployment.shutdown-ttl
86400000 ms Duration Time after which jobmanager pods of terminal application deployments are shut down.
kubernetes.operator.job.restart.failed
false Boolean Whether to restart failed jobs.
kubernetes.operator.job.upgrade.ignore-pending-savepoint
false Boolean Whether to ignore pending savepoint during job upgrade.
kubernetes.operator.job.upgrade.last-state-fallback.enabled
true Boolean Enables last-state fallback for savepoint upgrade mode. When the job is not running thus savepoint cannot be triggered but HA metadata is available for last state restore the operator can initiate the upgrade process when the flag is enabled.
kubernetes.operator.periodic.savepoint.interval
0 ms Duration Interval at which periodic savepoints will be triggered. The triggering schedule is not guaranteed, savepoints will be triggered as part of the regular reconcile loop.
kubernetes.operator.savepoint.format.type
CANONICAL

Enum

Type of the binary format in which a savepoint should be taken.

Possible values:
  • "CANONICAL": A canonical, common for all state backends format. It lets you switch state backends.
  • "NATIVE": A format specific for the chosen state backend, in its native binary format. Might be faster to take and restore from than the canonical one.
kubernetes.operator.savepoint.history.max.age
86400000 ms Duration Maximum age for savepoint history entries to retain. Due to lazy clean-up, the most recent savepoint may live longer than the max age.
kubernetes.operator.savepoint.history.max.count
10 Integer Maximum number of savepoint history entries to retain.
kubernetes.operator.savepoint.trigger.grace-period
1 min Duration The interval before a savepoint trigger attempt is marked as unsuccessful.
kubernetes.operator.user.artifacts.http.header
(none) Map Custom HTTP header for HttpArtifactFetcher. The header will be applied when getting the session job artifacts. Expected format: headerKey1:headerValue1,headerKey2:headerValue2.

Autoscaler Configuration #

Like other resource options these can be configured on both an operator and a per-resource level. When set under spec.flinkConfiguration for the Flink resources it will override the default value provided in the operator default configuration (flink-conf.yaml).

Key Default Type Description
kubernetes.operator.job.autoscaler.catch-up.duration
10 min Duration The target duration for fully processing any backlog after a scaling operation. Set to 0 to disable backlog based scaling.
kubernetes.operator.job.autoscaler.enabled
false Boolean Enable job autoscaler module.
kubernetes.operator.job.autoscaler.history.max.age
86400000 ms Duration Maximum age for past scaling decisions to retain.
kubernetes.operator.job.autoscaler.history.max.count
1 Integer Maximum number of past scaling decisions to retain per vertex.
kubernetes.operator.job.autoscaler.metrics.busy-time.aggregator
MAX

Enum

Metric aggregator to use for busyTime metrics. This affects how true processing/output rate will be computed. Using max allows us to handle jobs with data skew more robustly, while avg may provide better stability when we know that the load distribution is even.

Possible values:
  • "AVG"
  • "MAX"
  • "MIN"
kubernetes.operator.job.autoscaler.metrics.window
5 min Duration Scaling metrics aggregation window size.
kubernetes.operator.job.autoscaler.restart.time
5 min Duration Expected restart time to be used until the operator can determine it reliably from history.
kubernetes.operator.job.autoscaler.scale-down.max-factor
0.6 Double Max scale down factor. 1 means no limit on scale down, 0.6 means job can only be scaled down with 60% of the original parallelism.
kubernetes.operator.job.autoscaler.scale-up.grace-period
10 min Duration Period in which no scale down is allowed after a scale up
kubernetes.operator.job.autoscaler.scaling.effectiveness.detection.enabled
true Boolean Whether to enable detection of ineffective scaling operations and allowing the autoscaler to block further scale ups.
kubernetes.operator.job.autoscaler.scaling.effectiveness.threshold
0.1 Double Processing rate increase threshold for detecting ineffective scaling threshold. 0.1 means if we do not accomplish at least 10% of the desired capacity increase with scaling, the action is marked ineffective.
kubernetes.operator.job.autoscaler.scaling.enabled
true Boolean Enable vertex scaling execution by the autoscaler. If disabled, the autoscaler will only collect metrics and evaluate the suggested parallelism for each vertex but will not upgrade the jobs.
kubernetes.operator.job.autoscaler.scaling.sources.enabled
true Boolean Whether to enable scaling source vertices. Source vertices set the baseline ingestion rate for the processing based on the backlog size. If disabled, only regular job vertices will be scaled and source vertices will be unchanged.
kubernetes.operator.job.autoscaler.stabilization.interval
5 min Duration Stabilization period in which no new scaling will be executed
kubernetes.operator.job.autoscaler.target.utilization
0.7 Double Target vertex utilization
kubernetes.operator.job.autoscaler.target.utilization.boundary
0.1 Double Target vertex utilization boundary. Scaling won't be performed if utilization is within (target - boundary, target + boundary)
kubernetes.operator.job.autoscaler.vertex.max-parallelism
2147483647 Integer The maximum parallelism the autoscaler can use. Note that this limit will be ignored if it is higher than the max parallelism configured in the Flink config or directly on each operator.
kubernetes.operator.job.autoscaler.vertex.min-parallelism
1 Integer The minimum parallelism the autoscaler can use.

System Metrics Configuration #

Operator system metrics configuration. Cannot be overridden on a per-resource basis.

Key Default Type Description
kubernetes.operator.josdk.metrics.enabled
true Boolean Enable forwarding of Java Operator SDK metrics to the Flink metric registry.
kubernetes.operator.jvm.metrics.enabled
true Boolean Enable Kubernetes Operator JVM metrics.
kubernetes.operator.kubernetes.client.metrics.enabled
true Boolean Enable KubernetesClient metrics for measuring the HTTP traffic to the Kubernetes API Server.
kubernetes.operator.kubernetes.client.metrics.http.response.code.groups.enabled
false Boolean Enable KubernetesClient metrics for measuring the HTTP traffic to the Kubernetes API Server by response code group, e.g. 1xx, 2xx.
kubernetes.operator.metrics.histogram.sample.size
1000 Integer Defines the number of measured samples when calculating statistics.
kubernetes.operator.metrics.scope.k8soperator.resource
"<host>.k8soperator.<namespace>.<name>.resource.<resourcens>.<resourcename>.<resourcetype>" String Defines the scope format string that is applied to all metrics scoped to the kubernetes operator resource.
kubernetes.operator.metrics.scope.k8soperator.resourcens
"<host>.k8soperator.<namespace>.<name>.namespace.<resourcens>.<resourcetype>" String Defines the scope format string that is applied to all metrics scoped to the kubernetes operator resource namespace.
kubernetes.operator.metrics.scope.k8soperator.system
"<host>.k8soperator.<namespace>.<name>.system" String Defines the scope format string that is applied to all metrics scoped to the kubernetes operator.
kubernetes.operator.resource.lifecycle.metrics.enabled
true Boolean Enable resource lifecycle state metrics. This enables both state and transition counts/histograms.
kubernetes.operator.resource.lifecycle.namespace.histograms.enabled
true Boolean In addition to the system level histograms, enable per namespace tracking of state and transition times.
kubernetes.operator.resource.metrics.enabled
true Boolean Enables metrics for FlinkDeployment and FlinkSessionJob custom resources.

Advanced System Configuration #

Advanced operator system configuration. Cannot be overridden on a per-resource basis.

Key Default Type Description
kubernetes.operator.config.cache.size
1000 Integer Max config cache size.
kubernetes.operator.config.cache.timeout
10 min Duration Expiration time for cached configs.
kubernetes.operator.dynamic.config.check.interval
5 min Duration Time interval for checking config changes.
kubernetes.operator.dynamic.config.enabled
true Boolean Whether to enable on-the-fly config changes through the operator configmap.
kubernetes.operator.health.probe.enabled
true Boolean Enables health probe for the kubernetes operator.
kubernetes.operator.health.probe.port
8085 Integer The port the health probe will use to expose the status.
kubernetes.operator.label.selector
(none) String Label selector of the custom resources to be watched. Please see https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors for the format supported.
kubernetes.operator.observer.progress-check.interval
10 s Duration The interval for observing status for in-progress operations such as deployment and savepoints.
kubernetes.operator.observer.rest-ready.delay
10 s Duration Final delay before deployment is marked ready after port becomes accessible.
kubernetes.operator.savepoint.history.max.age.threshold
(none) Duration Maximum age threshold for savepoint history entries to retain.
kubernetes.operator.savepoint.history.max.count.threshold
(none) Integer Maximum number threshold of savepoint history entries to retain.
kubernetes.operator.startup.stop-on-informer-error
true Boolean Whether informer errors should stop operator startup. If false, the startup will ignore recoverable errors, caused for example by RBAC issues and will retry periodically.
kubernetes.operator.termination.timeout
10 s Duration Operator shutdown timeout before reconciliation threads are killed.