From 7e873ca3292787835a615f4be205f8a7bb89098e Mon Sep 17 00:00:00 2001 From: Harsimran Singh Maan Date: Fri, 7 Aug 2020 16:25:19 -0700 Subject: [PATCH] Add usage example Partially addresses #8 --- README.md | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/README.md b/README.md index 41e6320..28add88 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,104 @@ The following requests are supported: Since the proxy is stateless, it can be scaled horizontally. Multiple replicas can be used to ensure uptime during deployments and handle pod failure. +The proxy can be deployed to a Kubernetes namespace running Jupyterhub by applying the following config: +Change SUB_DOMAIN_HOST to a value to a hostname where jupyterhub is hosted. + +```yaml +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: jupyterhub + component: proxy + name: proxy +spec: + replicas: 3 + revisionHistoryLimit: 1 + selector: + matchLabels: + app: jupyterhub + component: proxy + strategy: + type: RollingUpdate + template: + metadata: + labels: + app: jupyterhub + component: proxy + spec: + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchExpressions: + - key: name + operator: In + values: + - proxy + topologyKey: kubernetes.io/hostname + weight: 100 + containers: + - command: + - /proxy/jupyterhub-istio-proxy + env: + - name: CONFIGPROXY_AUTH_TOKEN + valueFrom: + secretKeyRef: + key: proxy.token + name: hub-secret + - name: ISTIO_GATEWAY + value: istio-gateway/jupyterhub-gateway + - name: K8S_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: SUB_DOMAIN_HOST + value: example.com + - name: VIRTUAL_SERVICE_PREFIX + value: jupyterhub + - name: WAIT_FOR_WARMUP + value: "true" + image: splunk/jupyterhub-istio-proxy:v0.0.1 + imagePullPolicy: IfNotPresent + name: proxy + ports: + - containerPort: 8000 + name: proxy-public + protocol: TCP + resources: + limits: + cpu: "1" + memory: 256M + requests: + cpu: 100m + memory: 256M + securityContext: + allowPrivilegeEscalation: false + nodeSelector: {} + securityContext: + runAsNonRoot: true + terminationGracePeriodSeconds: 60 + +--- +apiVersion: v1 +kind: Service +metadata: + name: proxy-api +spec: + ports: + - name: http-proxy-api + port: 80 + protocol: TCP + targetPort: 8000 + selector: + component: proxy + type: ClusterIP + +``` + # Testing setup https://github.com/golang/mock is used for creating mocks for testing.