Skip to content

Commit b3e886e

Browse files
authored
Merge pull request #6 from oracle-quickstart/update/better-defaults
Update/better defaults
2 parents dbcaaf9 + 6ffd4e0 commit b3e886e

7 files changed

+75
-19
lines changed

README.md

+18-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# oke-flink
22

3-
Deploy Flink Operator on a Kubernetes cluster on Oracle Cloud Infrastructure.
3+
Deploy a Kubernetes cluster on Oracle Cloud Infrastructure with multiple node pools and add-ons like Apache Flink.
44

55
[![Deploy to Oracle Cloud][magic_button]][magic_oke_flink_stack]
66

@@ -15,7 +15,8 @@ The OKE cluster template features the following:
1515
- Option to use Secrets encryption.
1616
- Option to enable Image Validation and Pod Admission Controllers.
1717
- Option to install metrics server (required by cluster auto-scaler)
18-
- Opton to install cert-manager (required by Flink Operator)
18+
- Option to install cert-manager (required by Flink Operator)
19+
- Option to install a monitoring stack based on Prometheus and Grafana
1920

2021
## Getting started with Apache Flink Operator
2122

@@ -64,6 +65,8 @@ spec:
6465
# high-availability.storageDir: s3://<state_storage_bucket>/ha
6566
rest.flamegraph.enabled: "true"
6667
restart-strategy: exponential-delay
68+
metrics.reporters: prom
69+
metrics.reporter.prom.factory.class: org.apache.flink.metrics.prometheus.PrometheusReporterFactory
6770
serviceAccount: flink
6871
podTemplate:
6972
apiVersion: v1
@@ -130,6 +133,19 @@ spec:
130133
upgradeMode: stateless # Use savepoint if state management is configuered. `last-state` is not supported.
131134
```
132135
136+
## Send Flink metrics to Prometheus
137+
138+
To send Flink metrics to Prometheus, some specific configuration is needed in the Flink deployment.
139+
140+
Make sure to add the following to you Flink Session or Application deployment:
141+
142+
```yaml
143+
spec:
144+
flinkConfiguration:
145+
metrics.reporters: prom
146+
metrics.reporter.prom.factory.class: org.apache.flink.metrics.prometheus.PrometheusReporterFactory
147+
```
148+
133149
## Use the Terraform template
134150
135151
To use the Terraform template locally, configure the OCI Command Line Interface with a Private/Public key pair added to your user.

add_on_helm_flink.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
resource "helm_release" "flink_operator" {
55
count = var.enable_flink ? 1 : 0
66
name = "flink-operator"
7-
repository = "https://downloads.apache.org/flink/flink-kubernetes-operator-1.3.1/"
7+
repository = "https://downloads.apache.org/flink/flink-kubernetes-operator-1.4.0/"
88
chart = "flink-kubernetes-operator"
99
namespace = "flink"
1010
create_namespace = true

add_on_monitoring_stack.tf

-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ locals {
1010
grafana_plugins = file("${path.module}/templates/grafana.plugins.yaml")
1111
}
1212

13-
output dash {
14-
value = local.grafana_dashboards
15-
}
16-
1713
resource "random_password" "grafana_password" {
1814
count = local.enable_monitoring_stack ? 1 : 0
1915
length = 20

examples/flink-basic-example.yaml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
################################################################################
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
################################################################################
18+
19+
apiVersion: flink.apache.org/v1beta1
20+
kind: FlinkDeployment
21+
metadata:
22+
name: basic-example
23+
spec:
24+
image: flink:1.15
25+
flinkVersion: v1_15
26+
flinkConfiguration:
27+
taskmanager.numberOfTaskSlots: "2"
28+
metrics.reporters: prom
29+
metrics.reporter.prom.factory.class: org.apache.flink.metrics.prometheus.PrometheusReporterFactory
30+
serviceAccount: flink
31+
jobManager:
32+
resource:
33+
memory: "2048m"
34+
cpu: 1
35+
taskManager:
36+
resource:
37+
memory: "2048m"
38+
cpu: 1
39+
job:
40+
jarURI: local:///opt/flink/examples/streaming/StateMachineExample.jar
41+
parallelism: 2
42+
upgradeMode: stateless

schema.yaml

+5-3
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ variables:
410410
dependsOn:
411411
compartmentId: cluster_compartment_id
412412
required: true
413+
default: 4
413414
visible:
414415
and:
415416
- ge:
@@ -442,6 +443,7 @@ variables:
442443
dependsOn:
443444
compartmentId: cluster_compartment_id
444445
required: true
446+
default: 64
445447
visible:
446448
and:
447449
- ge:
@@ -502,7 +504,7 @@ variables:
502504
type: number
503505
minimum: 1
504506
maximum: 256
505-
default: 3
507+
default: 6
506508
title: Maximum Number of Nodes
507509
description: Maximum number of nodes the pool can scale to.
508510
required: true
@@ -700,7 +702,7 @@ variables:
700702
type: number
701703
minimum: 1
702704
maximum: 256
703-
default: 3
705+
default: 6
704706
title: Maximum Number of Nodes
705707
description: Maximum number of nodes the pool can scale to.
706708
required: true
@@ -890,7 +892,7 @@ variables:
890892
type: number
891893
minimum: 1
892894
maximum: 256
893-
default: 3
895+
default: 6
894896
title: Maximum Number of Nodes
895897
description: Maximum number of nodes the pool can scale to.
896898
required: true

templates/prometheus_flink.scrapeConfigs.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
scrape_interval: 3s
44
kubernetes_sd_configs:
55
- role: pod
6-
namespaces:
7-
names:
8-
- flink
96
relabel_configs:
107
- source_labels: [__meta_kubernetes_pod_label_component]
118
action: keep
129
regex: '(job|task)manager'
10+
- source_labels: [__meta_kubernetes_namespace]
11+
action: keep
12+
regex: flink
1313
- source_labels: [__meta_kubernetes_pod_ip]
1414
action: replace
1515
target_label: __address__

variables.tf

+6-6
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ variable "np1_node_shape" {
9191
}
9292

9393
variable "np1_ocpus" {
94-
default = 1
94+
default = 4
9595
}
9696

9797
variable "np1_memory_gb" {
98-
default = 4
98+
default = 64
9999
}
100100

101101
variable "np1_image_id" {
@@ -147,11 +147,11 @@ variable "np2_node_shape" {
147147
}
148148

149149
variable "np2_ocpus" {
150-
default = 1
150+
default = 4
151151
}
152152

153153
variable "np2_memory_gb" {
154-
default = 4
154+
default = 64
155155
}
156156

157157
variable "np2_image_id" {
@@ -203,11 +203,11 @@ variable "np3_node_shape" {
203203
}
204204

205205
variable "np3_ocpus" {
206-
default = 1
206+
default = 4
207207
}
208208

209209
variable "np3_memory_gb" {
210-
default = 4
210+
default = 64
211211
}
212212

213213
variable "np3_image_id" {

0 commit comments

Comments
 (0)