Demo using Cloud Clusters
This topic describes the steps to install KubeSlice on cloud clusters. To install the KubeSlice Controller and its components on
your existing clusters, use the kubeslice-cli install command.
Prerequisites
Before you begin, ensure the following prerequisites are met:
- You have set up the environment to install the KubeSlice Controller on the cluster. For more information, see Prerequisites.
- You have set up the environment for the worker clusters. For more information, see Prerequisites.
- You have authenticated the worker clusters with the cloud providers. For more information, see Preparing the clusters for registration.
- You have installed Istio on the worker clusters to configure the external gateways.
- You have cluster administrator privileges to install the KubeSlice Controller on controller cluster and the Slice Operator on worker clusters.
Install KubeSlice
In this demonstration, let us install KubeSlice on cloud clusters using the custom topology configuration YAML.
Install the KubeSlice Controller and Worker Clusters
You must create a topology configuration file that includes the names of the clusters and the cluster contexts that host the KubeSlice Controller, the worker clusters, and a project name. For more information, see the sample topology configuration file.
Use the following command to install the controller and the worker cluster:
kubeslice-cli --config=<topology-configuration-file> install
The above command installs the KubeSlice Controller, creates a project, and registers the worker cluster with the project by installing the Slice Operator on the worker cluster.
Register a Worker Cluster
The kubeslice-cli allows you to add a new worker cluster to an existing KubeSlice configuration.
Use the following template to add a new worker cluster.
configuration:
  cluster_configuration:
    kube_config_path: <kubeconfig-file>
    controller:
      name: <controller-cluster-name>
      context_name: <controller-cluster-context>
    workers:
      - name: <new-worker-cluster-name>
        context_name: <new-worker-cluster-context>
  kubeslice_configuration:
    project_name: <project-namespace>
The following is an example topology file for registering a new worker cluster.
configuration:
  cluster_configuration:
    kube_config_path: <PATH-TO-KUBECONFIG>
    controller:
      name: controller
      context_name: kind-controller
    workers:
      - name: worker-3
        context_name: cloud-cluster-3      
  kubeslice_configuration:
    project_name: avesha
Use the following command to register a new worker cluster with the KubeSlice Controller:
kubeslice-cli install --config=<new-worker-topology-yaml> -s controller
Onboard Namespaces
To onboard your existing namespaces (and their applications) onto a slice, follow these steps:
- Create a slice configuration YAML file (choose the namespaces, clusters, and so on to be part of the slice).
- Use the kubeslice-cli createcommand to apply the slice configuration YAML file.
Create a Slice
Use the following template to create a slice configuration YAML file.
To understand more about the configuration parameters, see Slice Configuration Parameters.
apiVersion: controller.kubeslice.io/v1alpha1
kind: SliceConfig
metadata:
  name: <slice-name>                #The name of the slice
spec:  
  sliceSubnet: <slice-subnet>        #The slice subnet
  sliceType: Application
  sliceGatewayProvider:
    sliceGatewayType: OpenVPN
    sliceCaType: Local
  sliceIpamType: Local
  clusters:
  - <worker-cluster-name1>           #The name of your worker cluster1
  - <worker-cluster-name2>           #The name of your worker cluster2
  qosProfileDetails:
    queueType: HTB
    priority: 0
    tcType: BANDWIDTH_CONTROL
    bandwidthCeilingKbps: 30000
    bandwidthGuaranteedKbps: 20000
    dscpClass: AF11
Apply the Slice Configuration YAML file
The kubeslice-cli create sliceConfig -n <project-namespace> -f <slice-configuration-yaml> command returns successfully after the slice
configuration is applied. However, in each cluster, the relevant pods for controlling and managing the slice may still be starting.
Ensure to wait for the slice to complete the initialization before deploying services to it.
To apply the slice configuration YAML, use the following command:
kubeslice-cli create sliceConfig -n <project-namespace> -f <slice-configuration-yaml>
Example
kubeslice-cli create sliceConfig -n kubeslice-avesha -f slice-config.yaml
Example output
🏃 Running command: /usr/local/bin/kubectl apply -f slice-config.yaml -n kubeslice-avesha
sliceconfig.controller.kubeslice.io/slice-red created
Successfully Applied Slice Configuration.
Deploy the Application
If the application is already deployed on a namespace that is onboarded to a slice, then re-deploy the application.
Create a Service Export
To create a service export, use the following command:
kubeslice-cli create serviceExportConfig -f <service-export-yaml> -n <project-namespace>
Validate the Service Export
When an application service runs on one of the worker clusters that are onboarded to a slice, the worker generates a ServiceExport for the application and propagates it to the KubeSlice Controller.
To verify the service export on the controller cluster, use the following command:
kubeslice-cli get serviceExportConfig -n <project-namespace>
Example
kubeslice-cli get serviceExportConfig -n kubeslice-avesha
Example Output
Fetching KubeSlice serviceExportConfig...
🏃 Running command: /usr/local/bin/kubectl get serviceexportconfigs.controller.kubeslice.io -n kubeslice-avesha
NAME                             AGE
iperf-server-iperf-cloud-worker-1   43s
To view the details of the service export configuration, use the following command:
kubeslice-cli describe serviceExportConfig <resource-name> -n <project-namespace>
Example
kubeslice-cli describe serviceExportConfig iperf-server-iperf-cloud-worker-1 -n kubeslice-avesha
The following output shows the ServiceExportConfig for iperf-server application is present on the controller cluster.
Describe KubeSlice serviceExportConfig...
🏃 Running command: /usr/local/bin/kubectl describe serviceexportconfigs.controller.kubeslice.io iperf-server-iperf-cloud-worker-1 -n kubeslice-avesha
Name:         iperf-server-iperf-cloud-worker-1
Namespace:    kubeslice-avesha
Labels:       original-slice-name=slice-red
              service-name=iperf-server
              service-namespace=iperf
              worker-cluster=cloud-worker-1
Annotations:  <none>
API Version:  controller.kubeslice.io/v1alpha1
Kind:         ServiceExportConfig
Spec:
  Service Discovery Ports:
    Name:             tcp
    Port:             5201
    Protocol:         TCP
  Service Name:       iperf-server
  Service Namespace:  iperf
  Slice Name:         slice-red
  Source Cluster:     cloud-worker-1
Modify the Service Discovery Configuration
kubeslice-cli enables you to modify the service discovery parameters. For example, to modify the port on which the service is running, edit the value and save. This updates the ServiceExportConfig. The ServiceExportConfig will again be propagated to all the worker clusters.
To edit the service export configuration, use the following command:
kubeslice-cli edit serviceExportConfig <resource-name> -n <project-namespace>
Example
kubeslice-cli edit serviceExportConfig iperf-server-iperf-cloud-worker-1 -n kubeslice-avesha
Example Output
Editing KubeSlice serviceExportConfig...
🏃 Running command: /usr/local/bin/kubectl edit serviceexportconfigs.controller.kubeslice.io iperf-server-iperf-cloud-worker-1 -n kubeslice-avesha
...
Uninstall KubeSlice
To uninstall KubeSlice from your cloud clusters, follow the instructions in Uninstall KubeSlice.