K8s Plugins#

Tags: Kubernetes, Integration, KubernetesOperator, Spark, AWS, GCP, MachineLearning, DistributedComputing, Advanced

This guide gives an overview of setting up the K8s Operator backend plugin in your Flyte deployment.

Add Flyte chart repo to Helm.

helm repo add flyteorg https://flyteorg.github.io/flyte

Set up the cluster#

Start the sandbox cluster:

flytectl demo start

Generate flytectl config:

flytectl config init

Install the K8S Operator#

Clone the PyTorch repository:

git clone https://github.com/kubeflow/pytorch-operator.git

Build and apply the PyTorch operator:

export KUBECONFIG=$KUBECONFIG:~/.kube/config:~/.flyte/k3s/k3s.yaml
kustomize build pytorch-operator/manifests/overlays/kubeflow | kubectl apply -f -

Specify Plugin Configuration#

Create a file named values-override.yaml and add the following config to it:

Enable PyTorch backend plugin:

    # -- Task specific configuration [structure](https://pkg.go.dev/github.com/flyteorg/flytepropeller/pkg/controller/nodes/task/config#GetConfig)
      # -- Plugins configuration, [structure](https://pkg.go.dev/github.com/flyteorg/flytepropeller/pkg/controller/nodes/task/config#TaskPluginConfig)
        # -- [Enabled Plugins](https://pkg.go.dev/github.com/flyteorg/flyteplugins/go/tasks/config#Config). Enable SageMaker*, Athena if you install the backend
        # plugins
          - container
          - sidecar
          - k8s-array
          - pytorch
          container: container
          sidecar: sidecar
          container_array: k8s-array
          pytorch: pytorch

Upgrade the Flyte Helm release#

helm upgrade flyte-core flyteorg/flyte-core -f https://raw.githubusercontent.com/flyteorg/flyte/master/charts/flyte-core/values-sandbox.yaml -f values-override.yaml -n flyte

Register the plugin example#

flytectl register files --config ~/.flyte/config.yaml https://github.com/flyteorg/flytesnacks/releases/download/v0.3.112/snacks-cookbook-integrations-kubernetes-kfpytorch.tar.gz --archive -p flytesnacks -d development --version latest

Launch an execution#

  • Navigate to the Flyte Console’s UI (e.g. sandbox) and find the relevant workflow.

  • Click on Launch to open up a launch form.

  • Specify spark as the service account if launching a Spark example.

  • Submit the form to launch an execution.