Skip to content

Latest commit

 

History

History
102 lines (81 loc) · 2.92 KB

manually-setup.md

File metadata and controls

102 lines (81 loc) · 2.92 KB

Quick Start

This tutorial introduces how to setup KubeZoo on Kubernetes. KubeZoo should work with any standard Kubernetes cluster out of box, but for demo purposes, in this tutorial, we will use a kind cluster as the upstream cluster.

Prerequisites

Please install the latest version of

Create kind cluster and run kubezoo on it

Run the following command to create local kubezoo enviroment

make local-up

When all processes are ready, kubezoo will run on local port 6443, make sure that port is not occupied by another application and you will see the following output

Export kubezoo server to 6443
Forwarding from 127.0.0.1:6443 -> 6443
Forwarding from [::1]:6443 -> 6443

Connect to the KubeZoo!

$ kubectl api-resources --context zoo
NAME                              SHORTNAMES   APIVERSION                        NAMESPACED   KIND
...
tenants                                        tenant.kubezoo.io/v1alpha1       false        Tenant

Create a tenant

$ kubectl apply -f config/setup/sample_tenant.yaml --context zoo
tenant.tenant.kubezoo.io/111111 created

The tenant name must be a valid 6-character RFC 1123 DNS label prefix ([A-Za-z0-9][A-Za-z0-9\-]{5}).

Get the kubeconfigs of the tenant

$ kubectl get tenant 111111 --context zoo -o jsonpath='{.metadata.annotations.kubezoo\.io\/tenant\.kubeconfig\.base64}' | base64 --decode > 111111.kubeconfig

Create a pod as the tenant

$ kubectl apply --kubeconfig 111111.kubeconfig -f- <<EOF
apiVersion: v1
kind: Pod
metadata:
  name: test
spec:
  containers:
  - name: test
    image: busybox
    command:
    - tail
    args:
    - -f
    - /dev/null
    resources:
      limits:
        cpu: 0.5
        memory: '0.5Gi'
      requests:
        cpu: 0.5
        memory: '0.5Gi'
EOF
pod/test created

Get the pod as the tenant

$ kubectl get po --kubeconfig 111111.kubeconfig
NAME   READY   STATUS    RESTARTS   AGE
test   1/1     Running   0          44s

Get the pod as the cluster administrator

$ kubectl get po -A
NAMESPACE            NAME                                         READY   STATUS    RESTARTS   AGE
111111-default       test                                         1/1     Running   0          2m28s
default              kubezoo-0                                    1/1     Running   0          34m
default              kubezoo-etcd-0                               1/1     Running   0          34m
default              test                                         1/1     Running   0          2m41s
...