openloft

command module
v0.0.0-...-e5cf862 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 14 Imported by: 0

README

OpenLoft

License Makefile CI Go Report Card GitHub last commit (branch)


Quick Start (~ 1 minute)

1. Prerequisites
  • Setup a Kubernetes cluster with kind.

    git clone https://github.com/openloft/kind.git
    cd kind
    # Create a cluster with 1 control-plane node and 2 worker nodes,
    # install nginx ingress controller and
    # deploy fake device plugin to provision 8 NVIDIA GPUs on each worker node.
    just a
    
  • Deploy vCluster Operator.

    kubectl apply -f https://raw.githubusercontent.com/openloft/vcluster-operator/main/deploy/manifests.yaml
    
2. Deploy OpenLoft
kubectl apply -f https://raw.githubusercontent.com/openloft/openloft/main/deploy/manifests.yaml
3. Create a Cluster Domain
kubectl apply -f https://raw.githubusercontent.com/openloft/openloft/main/config/samples/storage_v1_clusterdomain.yaml
4. Create a vCluster Template

There are two types of vCluster templates in sample, isolated and default. The isolated template will create a vCluster with a resource quota. The default template will create a vCluster with no resource quota.

The below command will create a isolated vCluster template.

kubectl apply -f https://raw.githubusercontent.com/openloft/openloft/main/config/samples/isolated/storage_v1_virtualclustertemplate.yaml
5. Create a vCluster Instance
kubectl apply -f https://raw.githubusercontent.com/openloft/openloft/main/config/samples/isolated/storage_v1_virtualclusterinstance.yaml

By running the above command, a vCluster called isolated-sample would be created in the namespace vc-isolated-sample.

6. Retrieving the kube config from the vCluster secret

The secret is prefixed with vc- and ends with the vCluster name, so a vCluster instance called isolated-sample would create a secret called vc-isolated-sample in the namespace vc-isolated-sample. You can retrieve the kube config after the vCluster has started via:

kubectl get secret vc-isolated-sample -n vc-isolated-sample --template={{.data.config}} | base64 -D > kubeconfig.yaml

The secret will hold a kube config in this format:

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0t...
        server: https://isolated-sample.openloft.cn
  name: my-vcluster
contexts:
- context:
    cluster: my-vcluster
    user: my-vcluster
  name: my-vcluster
current-context: my-vcluster
kind: Config
preferences: {}
users:
- name: my-vcluster
  user:
    client-certificate-data: LS0tLS...
    client-key-data: LS0tLS...

To be able to access the vCluster, update the hosts file with 127.0.0.1 pointing to the vCluster ingress:

e.g. /etc/hosts on macOS/Linux:

127.0.0.1 isolated-sample.openloft.cn
7. Accessing the vCluster

You can access the vCluster via:

kubectl --kubeconfig kubeconfig.yaml get ns

Contributing

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
v1
Package v1 contains API Schema definitions for the demo v1 API group +kubebuilder:object:generate=true +groupName=storage.openloft.cn
Package v1 contains API Schema definitions for the demo v1 API group +kubebuilder:object:generate=true +groupName=storage.openloft.cn
controllers
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL