Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-24947] Support hostNetwork for native K8s integration on session mode #18119

Merged
merged 2 commits into from
Jan 25, 2022

Conversation

spoon-lz
Copy link
Contributor

What is the purpose of the change

Provide hostnetwork network mode for jobs running in native kubernetes mode to obtain better performance in unmanaged clusters(for session mode)

Brief change log

When a job is running in session mode, you can start the hostnetwork mode by configuring "kubernetes.hostnetwork.enabled=true". After it is turned on, the pod of JobManager and TaskManager will use the host network instead of the third-party CNI plug-in.

  1. Use a random port when starting a session
  2. Update the targetPort of the corresponding ports of InternalService and ExternalService to the real value whenever the session starts successfully

Verifying this change

The session and job are started when "kubernetes.hostnetwork.enabled=true" is configured. When the task is running normally, the JobManager is killed. After the JobManager is automatically started, the TaskManager will be correctly connected to the JobManager and can be connected to the session through flink-client

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (no)
  • The serializers: ( no)
  • The runtime per-record code paths (performance sensitive): (no )
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (yes )
  • The S3 file system connector: (no )

Documentation

  • Does this pull request introduce a new feature? (yes )
  • If yes, how is the feature documented? (docs)

@flinkbot
Copy link
Collaborator

flinkbot commented Dec 15, 2021

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

@flinkbot
Copy link
Collaborator

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit 7fcbf27 (Wed Dec 15 12:16:33 UTC 2021)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

Please see the Pull Request Review Guide for a full explanation of the review process.


The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

@spoon-lz
Copy link
Contributor Author

@flinkbot run azure

2 similar comments
@spoon-lz
Copy link
Contributor Author

@flinkbot run azure

@spoon-lz
Copy link
Contributor Author

@flinkbot run azure

@wangyang0918 wangyang0918 self-assigned this Dec 20, 2021
Copy link
Contributor

@wangyang0918 wangyang0918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spoon-lz Thanks for creating this PR. I think it could work in your internal use case. But we need to refine the PR in a good shape before merging. I left some comments and please have a look.

@spoon-lz
Copy link
Contributor Author

@wangyang0918 Thanks for helping review this PR, give me some time to modify them

Copy link
Contributor

@wangyang0918 wangyang0918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spoon-lz I appreciate that you updated this PR. It has looked really better to me.

I have left some comments about the implementations, especially about how to get the dynamic ports in KubernetesResourceManagerDriver. Also the unit tests could be optimized.

Copy link
Contributor

@wangyang0918 wangyang0918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spoon-lz Thanks for updating this PR again. It looks almost good to me and I just left some minor comments. Once they are addressed, I will try to merge this PR. Please make sure that this PR is also verified in minikube or a real K8s cluster.

Moreover, could you please squash the commits and refine the commit message. Maybe they could looks like following.

  • [hotfix][runtime] Extract a common method to parse rest port from web interface URL
  • [FLINK-24947][k8s] Support host network for native K8s integration

@wangyang0918
Copy link
Contributor

@spoon-lz I have quickly verified this PR works well in a minikube. Great work.

@spoon-lz spoon-lz force-pushed the flink-k8s-HostNetwork branch 4 times, most recently from 2361d49 to 99653eb Compare January 19, 2022 02:40
@spoon-lz
Copy link
Contributor Author

@wangyang0918 I think the code is sorted out already

Copy link
Contributor

@wangyang0918 wangyang0918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating this PR. I will address my last minor comments when merging.

wangyang0918 pushed a commit to spoon-lz/flink that referenced this pull request Jan 21, 2022
wangyang0918 pushed a commit to spoon-lz/flink that referenced this pull request Jan 21, 2022
@wangyang0918
Copy link
Contributor

cc @spoon-lz If you have no other comments, I will merge this PR once the azure pipeline gives the pass.

@spoon-lz
Copy link
Contributor Author

@wangyang0918 Thanks for your help, I think it's ok now

@wangyang0918
Copy link
Contributor

@spoon-lz I believe that you forget the changes in ClusterEntrypoint.java when you squash and refine the commits.

wangyang0918 pushed a commit to spoon-lz/flink that referenced this pull request Jan 24, 2022
@wangyang0918
Copy link
Contributor

wangyang0918 commented Jan 24, 2022

Force pushed because:

  • fix the BlobServerOptions.PORT is not set in the ClusterEntrypoint.java
  • rebase master

@spoon-lz
Copy link
Contributor Author

@wangyang0918 Thanks for helping me modify the code

@wangyang0918
Copy link
Contributor

Merging this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants