blob: e15895f850eaddf9f90ad8a23c1ccdf64ab74f4c [file] [log] [blame]
<!DOCTYPE html>
<html lang="en" dir=ZgotmplZ>
<head>
<link rel="stylesheet" href="/bootstrap/css/bootstrap.min.css">
<script src="/bootstrap/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" type="text/css" href="/font-awesome/css/font-awesome.min.css">
<script src="/js/anchor.min.js"></script>
<script src="/js/flink.js"></script>
<link rel="canonical" href="https://flink.apache.org/2021/02/10/how-to-natively-deploy-flink-on-kubernetes-with-high-availability-ha/">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Flink has supported resource management systems like YARN and Mesos since the early days; however, these were not designed for the fast-moving cloud-native architectures that are increasingly gaining popularity these days, or the growing need to support complex, mixed workloads (e.g. batch, streaming, deep learning, web services). For these reasons, more and more users are using Kubernetes to automate the deployment, scaling and management of their Flink applications.
From release to release, the Flink community has made significant progress in integrating natively with Kubernetes, from active resource management to “Zookeeperless” High Availability (HA).">
<meta name="theme-color" content="#FFFFFF"><meta property="og:title" content="How to natively deploy Flink on Kubernetes with High-Availability (HA)" />
<meta property="og:description" content="Flink has supported resource management systems like YARN and Mesos since the early days; however, these were not designed for the fast-moving cloud-native architectures that are increasingly gaining popularity these days, or the growing need to support complex, mixed workloads (e.g. batch, streaming, deep learning, web services). For these reasons, more and more users are using Kubernetes to automate the deployment, scaling and management of their Flink applications.
From release to release, the Flink community has made significant progress in integrating natively with Kubernetes, from active resource management to “Zookeeperless” High Availability (HA)." />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://flink.apache.org/2021/02/10/how-to-natively-deploy-flink-on-kubernetes-with-high-availability-ha/" /><meta property="article:section" content="posts" />
<meta property="article:published_time" content="2021-02-10T00:00:00+00:00" />
<meta property="article:modified_time" content="2021-02-10T00:00:00+00:00" />
<title>How to natively deploy Flink on Kubernetes with High-Availability (HA) | Apache Flink</title>
<link rel="manifest" href="/manifest.json">
<link rel="icon" href="/favicon.png" type="image/x-icon">
<link rel="stylesheet" href="/book.min.22eceb4d17baa9cdc0f57345edd6f215a40474022dfee39b63befb5fb3c596b5.css" integrity="sha256-IuzrTRe6qc3A9XNF7dbyFaQEdAIt/uObY777X7PFlrU=">
<script defer src="/en.search.min.2698f0d1b683dae4d6cb071668b310a55ebcf1c48d11410a015a51d90105b53e.js" integrity="sha256-Jpjw0baD2uTWywcWaLMQpV688cSNEUEKAVpR2QEFtT4="></script>
<!--
Made with Book Theme
https://github.com/alex-shpak/hugo-book
-->
<meta name="generator" content="Hugo 0.124.1">
<script>
var _paq = window._paq = window._paq || [];
_paq.push(['disableCookies']);
_paq.push(["setDomains", ["*.flink.apache.org","*.nightlies.apache.org/flink"]]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//analytics.apache.org/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
</head>
<body dir=ZgotmplZ>
<header>
<nav class="navbar navbar-expand-xl">
<div class="container-fluid">
<a class="navbar-brand" href="/">
<img src="/img/logo/png/100/flink_squirrel_100_color.png" alt="Apache Flink" height="47" width="47" class="d-inline-block align-text-middle">
<span>Apache Flink</span>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<i class="fa fa-bars navbar-toggler-icon"></i>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">About</a>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="/what-is-flink/flink-architecture/">Architecture</a>
</li>
<li>
<a class="dropdown-item" href="/what-is-flink/flink-applications/">Applications</a>
</li>
<li>
<a class="dropdown-item" href="/what-is-flink/flink-operations/">Operations</a>
</li>
<li>
<a class="dropdown-item" href="/what-is-flink/use-cases/">Use Cases</a>
</li>
<li>
<a class="dropdown-item" href="/what-is-flink/powered-by/">Powered By</a>
</li>
<li>
<a class="dropdown-item" href="/what-is-flink/roadmap/">Roadmap</a>
</li>
<li>
<a class="dropdown-item" href="/what-is-flink/community/">Community & Project Info</a>
</li>
<li>
<a class="dropdown-item" href="/what-is-flink/security/">Security</a>
</li>
<li>
<a class="dropdown-item" href="/what-is-flink/special-thanks/">Special Thanks</a>
</li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Getting Started</a>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="https://nightlies.apache.org/flink/flink-docs-stable/docs/try-flink/local_installation/">With Flink<i class="link fa fa-external-link title" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="dropdown-item" href="https://nightlies.apache.org/flink/flink-kubernetes-operator-docs-stable/docs/try-flink-kubernetes-operator/quick-start/">With Flink Kubernetes Operator<i class="link fa fa-external-link title" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="dropdown-item" href="https://nightlies.apache.org/flink/flink-cdc-docs-stable/docs/get-started/introduction/">With Flink CDC<i class="link fa fa-external-link title" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="dropdown-item" href="https://nightlies.apache.org/flink/flink-ml-docs-stable/docs/try-flink-ml/quick-start/">With Flink ML<i class="link fa fa-external-link title" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="dropdown-item" href="https://nightlies.apache.org/flink/flink-statefun-docs-stable/getting-started/project-setup.html">With Flink Stateful Functions<i class="link fa fa-external-link title" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="dropdown-item" href="https://nightlies.apache.org/flink/flink-docs-stable/docs/learn-flink/overview/">Training Course<i class="link fa fa-external-link title" aria-hidden="true"></i>
</a>
</li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Documentation</a>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="https://nightlies.apache.org/flink/flink-docs-stable/">Flink 1.19 (stable)<i class="link fa fa-external-link title" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="dropdown-item" href="https://nightlies.apache.org/flink/flink-docs-master/">Flink Master (snapshot)<i class="link fa fa-external-link title" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="dropdown-item" href="https://nightlies.apache.org/flink/flink-kubernetes-operator-docs-stable/">Kubernetes Operator 1.8 (latest)<i class="link fa fa-external-link title" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="dropdown-item" href="https://nightlies.apache.org/flink/flink-kubernetes-operator-docs-main">Kubernetes Operator Main (snapshot)<i class="link fa fa-external-link title" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="dropdown-item" href="https://nightlies.apache.org/flink/flink-cdc-docs-stable">CDC 3.0 (stable)<i class="link fa fa-external-link title" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="dropdown-item" href="https://nightlies.apache.org/flink/flink-cdc-docs-master">CDC Master (snapshot)<i class="link fa fa-external-link title" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="dropdown-item" href="https://nightlies.apache.org/flink/flink-ml-docs-stable/">ML 2.3 (stable)<i class="link fa fa-external-link title" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="dropdown-item" href="https://nightlies.apache.org/flink/flink-ml-docs-master">ML Master (snapshot)<i class="link fa fa-external-link title" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="dropdown-item" href="https://nightlies.apache.org/flink/flink-statefun-docs-stable/">Stateful Functions 3.3 (stable)<i class="link fa fa-external-link title" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="dropdown-item" href="https://nightlies.apache.org/flink/flink-statefun-docs-master">Stateful Functions Master (snapshot)<i class="link fa fa-external-link title" aria-hidden="true"></i>
</a>
</li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">How to Contribute</a>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="/how-to-contribute/overview/">Overview</a>
</li>
<li>
<a class="dropdown-item" href="/how-to-contribute/contribute-code/">Contribute Code</a>
</li>
<li>
<a class="dropdown-item" href="/how-to-contribute/reviewing-prs/">Review Pull Requests</a>
</li>
<li>
<a class="dropdown-item" href="/how-to-contribute/code-style-and-quality-preamble/">Code Style and Quality Guide</a>
</li>
<li>
<a class="dropdown-item" href="/how-to-contribute/contribute-documentation/">Contribute Documentation</a>
</li>
<li>
<a class="dropdown-item" href="/how-to-contribute/documentation-style-guide/">Documentation Style Guide</a>
</li>
<li>
<a class="dropdown-item" href="/how-to-contribute/improve-website/">Contribute to the Website</a>
</li>
<li>
<a class="dropdown-item" href="/how-to-contribute/getting-help/">Getting Help</a>
</li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link" href="/posts/">Flink Blog</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/downloads/">Downloads</a>
</li>
</ul>
<div class="book-search">
<div class="book-search-spinner hidden">
<i class="fa fa-refresh fa-spin"></i>
</div>
<form class="search-bar d-flex" onsubmit="return false;"su>
<input type="text" id="book-search-input" placeholder="Search" aria-label="Search" maxlength="64" data-hotkeys="s/">
<i class="fa fa-search search"></i>
<i class="fa fa-circle-o-notch fa-spin spinner"></i>
</form>
<div class="book-search-spinner hidden"></div>
<ul id="book-search-results"></ul>
</div>
</div>
</div>
</nav>
<div class="navbar-clearfix"></div>
</header>
<main class="flex">
<section class="container book-page">
<article class="markdown">
<h1>
<a href="/2021/02/10/how-to-natively-deploy-flink-on-kubernetes-with-high-availability-ha/">How to natively deploy Flink on Kubernetes with High-Availability (HA)</a>
</h1>
February 10, 2021 -
Yang Wang
<p><p>Flink has supported resource management systems like YARN and Mesos since the early days; however, these were not designed for the fast-moving cloud-native architectures that are increasingly gaining popularity these days, or the growing need to support complex, mixed workloads (e.g. batch, streaming, deep learning, web services).
For these reasons, more and more users are using Kubernetes to automate the deployment, scaling and management of their Flink applications.</p>
<p>From release to release, the Flink community has made significant progress in <strong>integrating natively with Kubernetes</strong>, from active resource management to “Zookeeperless” High Availability (HA).
In this blogpost, we&rsquo;ll recap the technical details of deploying Flink applications natively on Kubernetes, diving deeper into Flink’s Kubernetes HA architecture. We&rsquo;ll then walk you through a <a href="#example-application-cluster-with-ha"><strong>hands-on example</strong></a> of running a Flink <a href="//nightlies.apache.org/flink/flink-docs-stable/deployment/#application-mode">application cluster</a> on Kubernetes with HA enabled.
We’ll end with a conclusion covering the advantages of running Flink natively on Kubernetes, and an outlook into future work.</p>
<h1 id="native-flink-on-kubernetes-integration">
Native Flink on Kubernetes Integration
<a class="anchor" href="#native-flink-on-kubernetes-integration">#</a>
</h1>
<p>Before we dive into the technical details of how the Kubernetes-based HA service works, let us briefly explain what <em>native</em> means in the context of Flink deployments on Kubernetes:</p>
<ol>
<li>
<p>Flink is <strong>self-contained</strong>. There will be an embedded Kubernetes client in the Flink client, and so you will not need other external tools (<em>e.g.</em> kubectl, Kubernetes dashboard) to create a Flink cluster on Kubernetes.</p>
</li>
<li>
<p>The Flink client will contact the Kubernetes API server <strong>directly</strong> to create the JobManager deployment. The configuration located on the client side will be shipped to the JobManager pod, as well as the log4j and Hadoop configurations.</p>
</li>
<li>
<p>Flink’s ResourceManager will talk to the Kubernetes API server to <strong>allocate and release</strong> the TaskManager pods dynamically <strong>on-demand</strong>.</p>
</li>
</ol>
<p>All in all, this is similar to how Flink integrates with other resource management systems (<em>e.g.</em> YARN, Mesos), so it should be somewhat straightforward to integrate with Kubernetes if you’ve managed such deployments before — and especially if you already had some internal deployer for the lifecycle management of multiple Flink jobs.</p>
<center>
<img vspace="8" style="width:75%" src="/img/blog/2021-02-10-native-k8s-with-ha/native-k8s-architecture.png" />
<p>
<em><b>Fig. 1:</b> Architecture of Flink's native Kubernetes integration.</em>
</p>
</center>
<hr>
<h1 id="kubernetes-high-availability-service">
Kubernetes High Availability Service
<a class="anchor" href="#kubernetes-high-availability-service">#</a>
</h1>
<p>High Availability (HA) is a common requirement when bringing Flink to production: it helps prevent a single point of failure for Flink clusters.
Previous to the <a href="https://flink.apache.org/news/2020/12/10/release-1.12.0.html">1.12 release</a>, Flink has provided a Zookeeper HA service that has been widely used in production setups and that can be integrated in standalone cluster, YARN, or Kubernetes deployments.
However, managing a Zookeeper cluster on Kubernetes for HA would require an additional operational cost that could be avoided because, in the end, Kubernetes also provides some public APIs for leader election and configuration storage (<em>i.e.</em> ConfigMap).
From Flink 1.12, we leverage these features to make running a HA-configured Flink cluster on Kubernetes more convenient to users.</p>
<center>
<img vspace="8" style="width:72%" src="/img/blog/2021-02-10-native-k8s-with-ha/native-k8s-ha-architecture.png" />
<p>
<em><b>Fig. 2:</b> Architecture of Flink's Kubernetes High Availability (HA) service.</em>
</p>
</center>
<br>
The above diagram shows the architecture of Flink’s Kubernetes HA service, which works as follows:
<ol>
<li>
<p>For the <strong>leader election</strong>, a set of eligible JobManagers is identified. They all race to declare themselves as the leader, with one eventually becoming the active leader. The active JobManager then continually &ldquo;heartbeats&rdquo; to renew its position as the leader. In the meantime, all other standby JobManagers periodically make new attempts to become the leader — this ensures that the JobManager could <strong>failover quickly</strong>. Different components (<em>e.g.</em> ResourceManager, JobManager, Dispatcher, RestEndpoint) have separate leader election services and ConfigMaps.</p>
</li>
<li>
<p>The active leader publishes its address to the ConfigMap. It’s important to note that Flink will use the same ConfigMap for contending lock and storing the leader address. This ensures that there is <strong>no unexpected change</strong> snuck in during a periodic update.</p>
</li>
<li>
<p>The leader retrieval service is used to find the active leader’s address and allow the components to then <strong>register</strong> themselves. For example, TaskManagers retrieve the address of ResourceManager and JobManager for registration and to offer slots. Flink uses a <strong>Kubernetes watch</strong> in the leader retrieval service — once the content of ConfigMap changes, it usually means that the leader has changed, and so the listener can <strong>get the latest leader address immediately</strong>.</p>
</li>
<li>
<p>All other meta information (<em>e.g.</em> running jobs, job graphs, completed checkpoints and checkpointer counter) will be directly stored in the corresponding ConfigMaps. Only the leader can update the ConfigMap. The HA data will only be <strong>cleaned up</strong> once the Flink cluster reaches the global <strong>terminal state</strong>. Please note that only the pointers are stored in the ConfigMap; the concrete data will be stored in the DistributedStorage. This level of indirection is necessary to keep the amount of data in ConfigMap small (ConfigMap is built for data less than 1MB whereas state can grow to multiple GBs).</p>
</li>
</ol>
<h1 id="example-application-cluster-with-ha">
Example: Application Cluster with HA
<a class="anchor" href="#example-application-cluster-with-ha">#</a>
</h1>
<p>You&rsquo;ll need a running Kubernetes cluster and to get <code>kubeconfig</code> properly set to follow along.
You can use <code>kubectl get nodes</code> to verify that you’re all set!
In this blog post, we’re using <a href="https://minikube.sigs.k8s.io/docs/start/">minikube</a> for local testing.</p>
<p><strong>1. Build a Docker image with the Flink job</strong> (<code>my-flink-job.jar</code>) <strong>baked in</strong></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-dockerfile" data-lang="dockerfile"><span class="line"><span class="cl"><span class="k">FROM</span><span class="s"> flink:1.12.1</span><span class="err">
</span></span></span><span class="line"><span class="cl"><span class="err"></span><span class="k">RUN</span> mkdir -p <span class="nv">$FLINK_HOME</span>/usrlib<span class="err">
</span></span></span><span class="line"><span class="cl"><span class="err"></span><span class="k">COPY</span> /path/of/my-flink-job.jar <span class="nv">$FLINK_HOME</span>/usrlib/my-flink-job.jar<span class="err">
</span></span></span></code></pre></div><p>Use the above Dockerfile to build a user image (<code>&lt;user-image&gt;</code>) and then push it to your remote image repository:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ docker build -t &lt;user-image&gt; .
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">$ docker push &lt;user-image&gt;
</span></span></code></pre></div><br>
**2. Start a Flink Application Cluster**
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ ./bin/flink run-application <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> --detached <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> --parallelism <span class="m">4</span> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> --target kubernetes-application <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -Dkubernetes.cluster-id<span class="o">=</span>k8s-ha-app-1 <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -Dkubernetes.container.image<span class="o">=</span>&lt;user-image&gt; <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -Dkubernetes.jobmanager.cpu<span class="o">=</span>0.5 <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -Dkubernetes.taskmanager.cpu<span class="o">=</span>0.5 <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -Dtaskmanager.numberOfTaskSlots<span class="o">=</span><span class="m">4</span> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -Dkubernetes.rest-service.exposed.type<span class="o">=</span>NodePort <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -Dhigh-availability<span class="o">=</span>org.apache.flink.kubernetes.highavailability.KubernetesHaServicesFactory <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -Dhigh-availability.storageDir<span class="o">=</span>s3://flink-bucket/flink-ha <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -Drestart-strategy<span class="o">=</span>fixed-delay <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -Drestart-strategy.fixed-delay.attempts<span class="o">=</span><span class="m">10</span> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -Dcontainerized.master.env.ENABLE_BUILT_IN_PLUGINS<span class="o">=</span>flink-s3-fs-hadoop-1.12.1.jar <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -Dcontainerized.taskmanager.env.ENABLE_BUILT_IN_PLUGINS<span class="o">=</span>flink-s3-fs-hadoop-1.12.1.jar <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> local:///opt/flink/usrlib/my-flink-job.jar
</span></span></code></pre></div><br>
**3. Access the Flink Web UI** (http://minikube-ip-address:node-port) **and check that the job is running!**
<pre tabindex="0"><code>2021-02-05 17:26:13,403 INFO org.apache.flink.kubernetes.KubernetesClusterDescriptor [] - Create flink application cluster k8s-ha-app-1 successfully, JobManager Web Interface: http://192.168.64.21:32388
</code></pre><p>You should be able to find a similar log in the Flink client and get the JobManager web interface URL.</p>
<br>
**4. Kill the JobManager to simulate failure**
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ kubectl <span class="nb">exec</span> <span class="o">{</span>jobmanager_pod_name<span class="o">}</span> -- /bin/sh -c <span class="s2">&#34;kill 1&#34;</span>
</span></span></code></pre></div><br>
**5. Verify that the job recovers from the latest successful checkpoint**
<p>Refresh the Flink Web UI until the new JobManager is launched, and then search for the following JobManager logs to verify that the job recovers from the latest successful checkpoint:</p>
<pre tabindex="0"><code>2021-02-05 09:44:01,636 INFO org.apache.flink.runtime.checkpoint.CheckpointCoordinator [] - Restoring job 00000000000000000000000000000000 from Checkpoint 101 @ 1612518074802 for 00000000000000000000000000000000 located at &lt;checkpoint-not-externally-addressable&gt;.
</code></pre><br>
**6. Cancel the job**
<p>The job can be cancelled through the Flink the Web UI, or using the following command:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ ./bin/flink cancel --target kubernetes-application -Dkubernetes.cluster-id<span class="o">=</span>&lt;ClusterID&gt; &lt;JobID&gt;
</span></span></code></pre></div><p>When the job is cancelled, all the Kubernetes resources created by Flink (e.g. JobManager deployment, TaskManager pods, service, Flink configuration ConfigMap, leader-related ConfigMaps) will be deleted automatically.</p>
<h1 id="conclusion">
Conclusion
<a class="anchor" href="#conclusion">#</a>
</h1>
<p>The native Kubernetes integration was first introduced in Flink 1.10, abstracting a lot of the complexities of hosting, configuring, managing and operating Flink clusters in cloud-native environments.
After three major releases, the community has made great progress in supporting multiple deployment modes (i.e. session and application) and an alternative HA setup that doesn’t depend on Zookeeper.</p>
<p>Compared with <a href="//nightlies.apache.org/flink/flink-docs-master/deployment/resource-providers/standalone/kubernetes.html">standalone</a> Kubernetes deployments, the native integration is more <strong>user-friendly</strong> and requires less upfront knowledge about Kubernetes.
Given that Flink is now aware of the underlying Kubernetes cluster, it also can benefit from dynamic resource allocation and make <strong>more efficient use of Kubernetes cluster resources</strong>.
The next building block to deepen Flink’s native integration with Kubernetes is the pod template (<a href="https://issues.apache.org/jira/browse/FLINK-15656">FLINK-15656</a>), which will greatly enhance the flexibility of using advanced Kubernetes features (<em>e.g.</em> volumes, init container, sidecar container).
This work is already in progress and will be added in the upcoming 1.13 release!</p>
</p>
</article>
<div class="edit-this-page">
<p>
<a href="https://cwiki.apache.org/confluence/display/FLINK/Flink+Translation+Specifications">Want to contribute translation?</a>
</p>
<p>
<a href="//github.com/apache/flink-web/edit/asf-site/docs/content/posts/2021-02-10-native-k8s-with-ha.md">
Edit This Page<i class="fa fa-edit fa-fw"></i>
</a>
</p>
</div>
</section>
<aside class="book-toc">
<nav id="TableOfContents"><h3>On This Page <a href="javascript:void(0)" class="toc" onclick="collapseToc()"><i class="fa fa-times" aria-hidden="true"></i></a></h3>
<ul>
<li><a href="#native-flink-on-kubernetes-integration">Native Flink on Kubernetes Integration</a></li>
<li><a href="#kubernetes-high-availability-service">Kubernetes High Availability Service</a></li>
<li><a href="#example-application-cluster-with-ha">Example: Application Cluster with HA</a></li>
<li><a href="#conclusion">Conclusion</a></li>
</ul>
</nav>
</aside>
<aside class="expand-toc hidden">
<a class="toc" onclick="expandToc()" href="javascript:void(0)">
<i class="fa fa-bars" aria-hidden="true"></i>
</a>
</aside>
</main>
<footer>
<div class="separator"></div>
<div class="panels">
<div class="wrapper">
<div class="panel">
<ul>
<li>
<a href="https://flink-packages.org/">flink-packages.org</a>
</li>
<li>
<a href="https://www.apache.org/">Apache Software Foundation</a>
</li>
<li>
<a href="https://www.apache.org/licenses/">License</a>
</li>
<li>
<a href="/zh/">
<i class="fa fa-globe" aria-hidden="true"></i>&nbsp;中文版
</a>
</li>
</ul>
</div>
<div class="panel">
<ul>
<li>
<a href="/what-is-flink/security">Security</a-->
</li>
<li>
<a href="https://www.apache.org/foundation/sponsorship.html">Donate</a>
</li>
<li>
<a href="https://www.apache.org/foundation/thanks.html">Thanks</a>
</li>
</ul>
</div>
<div class="panel icons">
<div>
<a href="/posts">
<div class="icon flink-blog-icon"></div>
<span>Flink blog</span>
</a>
</div>
<div>
<a href="https://github.com/apache/flink">
<div class="icon flink-github-icon"></div>
<span>Github</span>
</a>
</div>
<div>
<a href="https://twitter.com/apacheflink">
<div class="icon flink-twitter-icon"></div>
<span>Twitter</span>
</a>
</div>
</div>
</div>
</div>
<hr/>
<div class="container disclaimer">
<p>The contents of this website are © 2024 Apache Software Foundation under the terms of the Apache License v2. Apache Flink, Flink, and the Flink logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and other countries.</p>
</div>
</footer>
</body>
</html>