Skip to content

[8970] Improve KubernetesPodOperator guide#9079

Merged
mik-laj merged 11 commits intoapache:masterfrom
tanjinP:issue-8970-improve-k8spodop-guide
Jul 20, 2020
Merged

[8970] Improve KubernetesPodOperator guide#9079
mik-laj merged 11 commits intoapache:masterfrom
tanjinP:issue-8970-improve-k8spodop-guide

Conversation

@tanjinP
Copy link
Contributor

@tanjinP tanjinP commented May 31, 2020

Addresses some of #8970

Currently have an outline of the items mentioned (docs/howto/operator/kubernetes.rst) in the issue and looking for feedback if this is a good approach to take to build out this documentation.

There are 5 subheadings, we mention what the content will be, if it includes a code example (currently there are none), and potential references to link (will avoid the blog/guides in favor of official documentation, like Kubernetes)


Make sure to mark the boxes below before creating PR: [x]

  • Description above provides context of the change
  • Unit tests coverage for changes (not needed for documentation changes)
  • Target Github ISSUE in description if exists
  • Commits follow "How to write a good git commit message"
  • Relevant documentation is updated including usage instructions.
  • I will engage committers as explained in Contribution Workflow Example.

In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.
Read the Pull Request Guidelines for more information.

The :class:`~airflow.providers.cncf.kubernetes.operators.kubernetes_pod.KubernetesPodOperator`:
The :class:`~airflow.providers.cncf.kubernetes.operators.kubernetes_pod.KubernetesPodOperator` allows
you to create and run Pods on a Kubernetes cluster.

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.. contents::
:depth: 1
:local:

@mik-laj
Copy link
Member

mik-laj commented May 31, 2020

Very good direction. We just need it.

@mik-laj mik-laj requested a review from dimberman May 31, 2020 19:33
@mik-laj
Copy link
Member

mik-laj commented Jul 3, 2020

@tanjinP Have you encountered any difficulties? Can I help you?

@tanjinP
Copy link
Contributor Author

tanjinP commented Jul 5, 2020

@tanjinP Have you encountered any difficulties? Can I help you?

@mik-laj thanks for checking in. Will come back to this and have the initial version complete by end of today if not tomorrow. Will mark the PR as ready then.

tanjinP added 4 commits July 5, 2020 11:12
@tanjinP tanjinP marked this pull request as ready for review July 6, 2020 02:22
@tanjinP tanjinP requested a review from mik-laj July 6, 2020 02:22
Copy link
Contributor

@dimberman dimberman left a comment

Choose a reason for hiding this comment

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

@tanjinP this looks fantastic! Just a few suggestions but otherwise thank you for writing this!

Copy link
Contributor

Choose a reason for hiding this comment

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

The KubernetesPodOperato uses the Kubernetes API to launch a pod in a Kubernetes cluster. By supplying an image URL and a bash command, the operator uses the Kube Python Client...

Copy link
Contributor

Choose a reason for hiding this comment

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

Users can specify a kubeconfig file using the config_file parameter, otherwise the operator will default to ~/.kube/config


The ``KubernetesPodOperator`` enables task-level resource configuration and is optimal for custom Python
dependencies that are not available through the public PyPI repository.
Ultimately, it allows Airflow to act a job orchestrator - no matter the language those jobs are written in.
Copy link
Contributor

Choose a reason for hiding this comment

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

The ```KubernetesPodOperatoralso allows users to supply a template yaml file using thepod_template_file`` configuration.

Copy link
Contributor

Choose a reason for hiding this comment

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

To pull images from a private registry*

Copy link
Contributor

Choose a reason for hiding this comment

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

/airflow/xcom*

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yikes - this was a good one.

@tanjinP tanjinP changed the title WIP: [8970] Improve KubernetesPodOperator guide [8970] Improve KubernetesPodOperator guide Jul 7, 2020
@tanjinP tanjinP requested a review from dimberman July 7, 2020 02:22
@tanjinP
Copy link
Contributor Author

tanjinP commented Jul 7, 2020

Looks like some static checks failing, will address

@mik-laj
Copy link
Member

mik-laj commented Jul 8, 2020

I would be happy to add information that Kubernetes Executor is not required for Kubernetes Pod Operator. Two sentences about the behavior of KubernetesPodOperator when installing into clusters would also be helpful, but we can add them in a separate change.

My opinion is based on the Slack discussion. This is an important feedback on what users are looking for in the documentation.
https://apache-airflow.slack.com/archives/CCV3FV9KL/p1594235643204100

.. note::
If you use `Google Kubernetes Engine <https://cloud.google.com/kubernetes-engine/>`__, consider
using the
:ref:`GKEStartPodOperator <howto/operator:GKEStartPodOperator>` operator as it
Copy link
Contributor

Choose a reason for hiding this comment

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

This link does currently appear to be working. should it be updated?

Copy link
Contributor

Choose a reason for hiding this comment

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

Some description that GKEStartPodOperator extends KubernetesPodOperator and that therefore the rest of this documentation is still applicable would be really helpful.

Copy link
Member

Choose a reason for hiding this comment

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

This link works. However, it is not available in the source code, but works in the HTML code generated. Please look at: https://airflow.readthedocs.io/en/latest/howto/operator/kubernetes.html

@tanjinP
Copy link
Contributor Author

tanjinP commented Jul 17, 2020

@mik-laj

I would be happy to add information that Kubernetes Executor is not required for Kubernetes Pod Operator.

Mentioned this as a note here

Two sentences about the behavior of KubernetesPodOperator when installing into clusters would also be helpful, but we can add them in a separate change.

Not sure what you mean here - what do you mean by installing into cluster? Do you mean setting up the kubeconfig? If so does the section How does this operator work? not cover it?

@mik-laj
Copy link
Member

mik-laj commented Jul 20, 2020

Not sure what you mean here - what do you mean by installing into cluster?

I checked my code and this behavior is unique to Cloud Composer. The team made one change to this operator. By default, the kube_config parameter points to a file that contains credentials for the current environment.
Screenshot 2020-07-20 at 14 52 31

@mik-laj mik-laj merged commit 840799d into apache:master Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments