This guide is a quickstart to deploying Kubeflow on Google Kubernetes Engine (GKE).
Running Kubeflow on GKE brings the following advantages:
Create an OAuth client ID to be used to identify Cloud IAP when requesting access to user’s email to verify their identity.
Set up your OAuth consent screen:
Configure the consent screen.
Under Email address, select the address that you want to display as a public contact. You must use either your email address or a Google Group that you own.
In the Product name box, enter a suitable name like kubeflow
.
If you see Authorized domains, enter
<project>.cloud.goog
Click Save.
Here’s a screenshot
On the Credentials screen:
Click Create credentials, and then click OAuth client ID.
Under Application type, select Web application.
In the Name box enter any name.
In the Authorized redirect URIs box, enter the following:
https://<name>.endpoints.<project>.cloud.goog/_gcp_gatekeeper/authenticate
<name>
and <project>
must have the same values as set in the next
step when you run the deployment script.<name>
but you can
configure this with the environment variable DEPLOYMENT_NAME
.<project>
is your GCP project.Here’s what the form should look like
Click Create.
Make note of the client ID and client secret that appear in the OAuth client window. You need them later to enable Cloud IAP.
Create environment variables from the OAuth client ID and secret:
export CLIENT_ID=<CLIENT_ID from OAuth page>
export CLIENT_SECRET=<CLIENT_SECRET from OAuth page>
Run the following steps to deploy Kubeflow:
Run the following script to download kfctl.sh
:
mkdir ${KUBEFLOW_SRC}
cd ${KUBEFLOW_SRC}
export KUBEFLOW_TAG=<a href="https://github.com/kubeflow/kubeflow/releases/tag/v0.3.0">v0.3.0</a>
curl https://raw.githubusercontent.com/kubeflow/kubeflow/${KUBEFLOW_TAG}/scripts/download.sh | bash
master
for latest code.Run the following scripts to set up and deploy Kubeflow:
${KUBEFLOW_REPO}/scripts/kfctl.sh init ${KFAPP} --platform gcp --project ${PROJECT}
cd ${KFAPP}
${KUBEFLOW_REPO}/scripts/kfctl.sh generate platform
${KUBEFLOW_REPO}/scripts/kfctl.sh apply platform
${KUBEFLOW_REPO}/scripts/kfctl.sh generate k8s
${KUBEFLOW_REPO}/scripts/kfctl.sh apply k8s
Check resources deployed in namespace kubeflow
:
kubectl -n kubeflow get all
Kubeflow will be available at the following URI:
https://<name>.endpoints.<project>.cloud.goog/
kubectl proxy
and kubectl port-forward
to connect to services in the cluster.We recommend checking in the contents of ${KFAPP} into source control.
To delete your deployment and reclaim all resources:
cd ${KFAPP}
${KUBEFLOW_REPO}/scripts/kfctl.sh delete all
The deployment process is controlled by 4 different commands:
With the exception of init
, all commands take an argument which describes the
set of resources to apply the command to; this argument can be one of the
following:
Your Kubeflow app directory contains the following files and directories:
env.sh defines several environment variables related to your Kubeflow deployment.
init
.${KFAPP}/gcp_config is a directory that contains Deployment Manager config Files defining your GCP infrastructure.
kfctl.sh generate platform
.${KFAPP}/k8s_specs is a directory that contains YAML specs for some daemons deployed on your Kubernetes Engine cluster.
${KFAPP}/ks_app is a directory that contains the ksonnet application for Kubeflow.
kfctl.sh generate k8s
.Creating a deployment using kfctl.sh
creates three service accounts in the GCP project. These service accounts are created using the principle of least privilege. The three service accounts are:
${KFAPP}-admin
${KFAPP}-user
${KFAPP}-vm
${KFAPP}-admin
is used for some admin tasks like configuring the load balancers. The idea here is that it’s needed to deploy Kubeflow but not needed to actually run jobs.
${KFAPP}-user
is intended to be used by training jobs and models to access GCP resources (GCS, BigQuery, etc…). It has a much smaller set of privileges compared to admin.
${KFAPP}-vm
is used only for the VM service account. It has minimal permissions to send metrics and logs to Stackdriver.
See how to customize or troubleshoot your Kubeflow deployment on GKE.