Skip to main content

Jupyter Contents

Jupyter Contents and its associated secrets must be placed in the datalayer-jupyter namespace.

Git repositories and S3 buckets contents are supported.

# Public Git repositories.
cat <<EOF | kubectl apply -f -
apiVersion: datalayer.io/v1
kind: JupyterContent
metadata:
name: jakevdp-sklearn-tutorial-content
namespace: datalayer-jupyter
spec:
description: Jake VanderPlas scikit-learn tutorial
type: git
source: https://github.com/jakevdp/sklearn_tutorial.git
EOF
# S3 Buckets - Authentication must be stored in the `s3-secret` Secret providing the following key.
# - `access_key_id`
# - `secret_access_key`
# - `region`
cat <<EOF | kubectl apply -f -
apiVersion: datalayer.io/v1
kind: JupyterContent
metadata:
name: s3-satellite-sentinels-images-content
namespace: datalayer-jupyter
spec:
description: Satellite images from Sentinels mission.
type: s3
source: datalayer-dev
permissions: ro
secret: s3-secret
EOF
kubectl get jupyter-contents -A
kubectl get jupyter-contents -o yaml -A

AWS S3 Buckets

Steps to create a AWS S3 bucket.

# TBD

Google Cloud Buckets

Steps to create a Google Cloud Storage bucket.

# Get to https://console.cloud.google.com/billing and copy the Billing Account ID value.
ACCOUNT_ID=<YOUR_ACCOUNT_ID>
# Create a new project (project id must be <=30 characters)
# RAND=$RANDOM
RAND=78027
PROJECT_ID="jupyterpool-$RAND"
# Create a GCloud Project
gcloud projects create $PROJECT_ID --enable-cloud-apis # [--organization $ORGANIZATION_ID]
gcloud config set project $PROJECT_ID
# or, record the PROJECT_ID value of an existing project
# PROJECT_ID=$(gcloud projects list --filter NAME=<YOUR_PROJECT_NAME> --format="value(PROJECT_ID)")
# Link billing to the new project.
gcloud beta billing projects link $PROJECT_ID --billing-account=$ACCOUNT_ID
# Enable GCloud Services on your Project
# Enable service on the new project.
gcloud services enable storage.googleapis.com --project $PROJECT_ID # Enable Compute API.
# Create a GCloud Service Account
SERVICE_ACCOUNT_NAME="example-$RAND"
SERVICE_ACCOUNT="${SERVICE_ACCOUNT_NAME}@${PROJECT_ID}.iam.gserviceaccount.com"
gcloud iam service-accounts create $SERVICE_ACCOUNT_NAME --project $PROJECT_ID --display-name "Google Cloud Bucket Example"
# Assign GCloud Roles to your service account.
gcloud projects add-iam-policy-binding $PROJECT_ID --member "serviceAccount:$SERVICE_ACCOUNT" --role="roles/storage.admin"
open https://console.cloud.google.com/iam-admin/serviceaccounts?project=jupyterpool-78027
# Teardonwn the project
gcloud projects delete $PROJECT_ID