kuiper

by EMQX

Helm chartv0.9.0App 0.9.0

A lightweight IoT edge analytic software

About this chart

Kuiper can be deployed at k3s/k8s cluster through Helm chart. Below takes k3s as an example for demonstrating how to deploy at k3s.

Prepare

  • Install K3S

    $ curl -sfL https://get.k3s.io | sh -
    $ sudo chmod 755 /etc/rancher/k3s/k3s.yaml
    $ kubectl get nodes
    NAME               STATUS   ROLES    AGE     VERSION
    ip-172-31-16-120   Ready    master   4m31s   v1.16.3-k3s.2
    
  • Install helm3

    $ curl -sfL https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash -
    Downloading https://get.helm.sh/helm-v3.0.1-linux-amd64.tar.gz
    Preparing to install helm into /usr/local/bin
    helm installed into /usr/local/bin/helm
    
    ## K8S can skip this step
    $ export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
    

Get Kuiper Helm Chart

  • With any approaches in below to get Kuiper Helm Chart, here uses git clone to get Helm chart.

    • Git clone

      $ git clone https://github.com/emqx/kuiper
      $ cd kuiper/deploy/chart/kuiper
      
    • Helm repo (TODO)

      • Add Helm repo

        $ helm repo add emqx https://repos.emqx.io/charts
        
      • Search Kuiper

        helm search kuiper
        NAME     		CHART VERSION	APP VERSION  	DESCRIPTION
        emqx/kuiper	0.0.3	        0.0.3	        A lightweight IoT edge analytic software
        
  • By edit values.yaml file or use command helm install --set to edit Kuiper Helm Chart configurations.

    Kuiper Helm Chart Configurations

    ParametersDescriptionsDefault Value
    replicaCountDeployed Kuiper instance number1
    image.repositoryDocker image nameemqx/kuiper
    image.pullPolicyPull policyIfNotPresent
    service.typeKubernetes Service type.ClusterIP
    service.kuiperPort for Kuiper.20498
    service.restapiPort for ReseApi.9081
    service.nodePorts.kuiperKubernetes node port for Kuiper.nil
    service.nodePorts.restapiKubernetes node port for RestAPi.nil
    service.loadBalancerIPloadBalancerIP for Servicenil
    service.loadBalancerSourceRangesAddress(es) that are allowed when service is LoadBalancer[]
    service.annotationsService annotations{}(evaluated as a template)
    persistence.enabledEnable PVCfalse
    persistence.storageClassStorage class namenil
    persistence.existingClaimPV name""
    persistence.accessModePVC access modeReadWriteOnce
    persistence.sizePVC size20Mi
    resourcesCPU/Memory{}
    nodeSelectorNode selector{}
    tolerationsTolerations[]
    affinityAffinity{}
    kuiperConfigConfiguration file in the Kuiper etc directory

Deploy Kuiper through Helm

Deploy Kuiper quickly

  • Deploy Kuiper through Helm

    $ helm install my-kuiper .
    NAME: my-kuiper
    LAST DEPLOYED: Mon Dec  9 09:56:32 2019
    NAMESPACE: default
    STATUS: deployed
    REVISION: 1
    TEST SUITE: None
    
  • Deployment is successful

    $ kubectl get pods
    NAME       READY   STATUS    RESTARTS   AGE
    my-kuiper-0   1/1     Running   0          19s
    
    $ kubectl exec -it  my-kuiper-0 sh
    /kuiper # ./bin/cli
    Connecting to 127.0.0.1:20498...
    

Deploy persisted Kuiper

  • Kuiper realized persisted pods through creating PVC resources and mount /kuiper/data directory. Before deploying Kuiper, user need to create PVC or Storage Classes resource in Kubernetes.

  • Open and edit values.yaml file, set persistence.enabled=true

    • If user deploys PVC resource, , then setpersistence.existingClaim=your_pv_name
    • If user deploys Storage Classes resource, then set persistence.storageClass=your_storageClass_name
  • Deploy Kuiper through Helm

    $ helm install my-kuiper .
    NAME: my-kuiper
    LAST DEPLOYED: Mon Dec  9 09:56:32 2019
    NAMESPACE: default
    STATUS: deployed
    REVISION: 1
    TEST SUITE: None
    
  • Deployment is successful

    $ kubectl get pods
    NAME       READY   STATUS    RESTARTS   AGE
    my-kuiper-0   1/1     Running   0          19s
    
    $ kubectl exec -it  my-kuiper-0 sh
    /kuiper # ./bin/cli
    Connecting to 127.0.0.1:20498...
    

Deploy Kuiper and using SSL certification and key

  • Use command kubectl create secret , create certification & private keys to Secret resources, the usage of command kubectl create secret is listed as in below:

    $ kubectl create secret generic your-secret-name --from-file=/path/to/file
    

    Create Secret resource for certification file:

    $ kubectl create secret generic client-cert --from-file=certs/client-cert.pem
    

    Create Secret for private key file:

    $ kubectl create secret generic client-key --from-file=certs/client-key.pem
    

    Review Secret resources

    $ kubectl get secret
    NAME                                         TYPE                                  DATA   AGE
    client-cert                                  Opaque                                1      25m
    client-key                                   Opaque                                1      24m
    
  • Open and edit values.yaml file

    $ vim value.yaml
    kuiperConfig:
    ...
      "mqtt_source.yaml":
        #Global MQTT configurations
        default:
          qos: 1
          sharedSubscription: true
          servers: [tcp://127.0.0.1:1883]
          concurrency: 1
          #username: user1
          #password: password
          certificationSecretName: client-cert  # Set certification Secret resource name
          certificationPath: /var/kuiper/certificate.pem # Set certification file path
          privateKeySecretName: client-key  # Set private key Secret resource name
          privateKeyPath: /var/kuiper/xyz-private.pem.key # Set private key file path
    ...
    
  • Deploy Kuiper through Helm

    $ helm install my-kuiper .
    NAME: my-kuiper
    LAST DEPLOYED: Mon Dec  9 09:56:32 2019
    NAMESPACE: default
    STATUS: deployed
    REVISION: 1
    TEST SUITE: None
    
  • Deployment is successful

    $ kubectl get pods
    NAME       READY   STATUS    RESTARTS   AGE
    my-kuiper-0   1/1     Running   0          19s
    
    $ kubectl exec -it my-kuiper-0 -- ls -al /var/kuiper
    total 8
    drwxr-xr-x    4 root     root          4096 Dec 10 02:23 .
    drwxr-xr-x    1 root     root          4096 Dec 10 02:23 ..
    drwxrwxrwt    3 root     root           100 Dec 10 02:23 certificate.pem
    drwxrwxrwt    3 root     root           100 Dec 10 02:23 private.pem.key
    
    $ kubectl exec -it  my-kuiper-0 sh
    /kuiper # ./bin/cli
    Connecting to 127.0.0.1:20498...
    

Deploy kuiper with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has kuiper on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartkuiper is pinned at v0.9.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply