Provisioning Skedler | Kubernetes

Modified on Mon, 6 Mar, 2023 at 5:02 AM

Previously, provisioning could only be done through the Skedler GUI. However, before users could begin creating reports or configuring Datasources, Orgs, and Notification channels, the Skedler service had to be running.

To address this limitation, we’ve decided to enhance the user experience by introducing a new active provisioning system based on configuration files.


This helps to reduce the time and effort required to set up Skedler infrastructure and mitigate the risk of errors making it easier to manage the Skedler service.



Step 1- Create a skedler-configmap.yaml file with the following content:


Note, If you've already deployed Skedler then start from Step 2 


apiVersion: v1
kind: ConfigMap
metadata:
  name: skedler-config
  labels:
    app: skedler
data:
  reporting.yml: |
    ---
    ######################################### SKEDLER REPORTS CONFIGURATION SETTINGS #########################################
    ################################################## ENVIRONMENT SETTINGS ##################################################
    # The environment where skedler is getting deployed. If you don't have an internet connection on your machine, change this as 'true' and enable `skedlerUsername` & `skedlerPassword` as well.
    # isOfflineEnvironment: false
    # Skedler default username and password. Enable this only if you sets `isOfflineEnvironment` as true. You can change username & password for your convenient to create skedler account.
    # skedlerUsername: 'admin@skedler.com'
    # skedlerPassword: 'admin'
    ##################################################### HOST SETTINGS ######################################################
    # The port which skedler runs
    serverPort: 3005
    # The port which skedler need to run redis
    redisPort: 6379
    # The public facing host name or IP address used to access Skdler from a browser
    # host: "127.0.0.1"
    # Protocol (http, https)
    #protocol: 'http'
    # To enable SSL certificate Verification, change this as 'false'
    # skipSslVerification: true
    # The path, which you can use for the proxy purpose with skedler, Specially for Ngnix etc. For example: '/skedler'
    # proxyBasePath: '/skedler'
    ##################################################### LOG SETTINGS ######################################################
    # The path where you need to keep the skedler log files, For example: '/var/opt/skedler-xg'. Leave empty for the default path
    # logFilesDir: ''
    ################################################### DATABASE SETTINGS ###################################################
    # The path where you need to keep the database, For example: '/var/lib/skedler-xg'. Leave empty for the default path
    # databasePath: ''
    # Database where skedler is going to store the data, default is 'sqlite'. you can change as 'mysql', If you're using 'mysql' enable the below properties
    # datastore: 'sqlite'
    # Enable and configure only if you are choosing datastore as `mysql`
    # databaseHost: 'localhost'
    # databasePort: 3306
    # accountDatabaseName: 'sks_accounts'
    # tenantDatabaseName: 'sks_tenant'
    # databaseUsername: 'admin'
    # databasePassword: 'password'
    # dialect: 'mysql'
    # Maximum number of connection in pool, default: 5
    # maxConn: 5
    # Minimum number of connection in pool, default: 0
    # minConn: 0
    # The maximum time, in milliseconds, that a connection can be idle before being released, default: 10000
    # connIdleTime: 10000
    # The maximum time, in milliseconds, that pool will try to get connection before throwing error, default: 10000
    # connAcquireTime: 10000

    ################################################### LICENSE SETTINGS ####################################################
    # Specially for Docker/Kubernetes/VM to persist the license which has been activated previously
    # licenseEmail: ''
    # licenseKey: ''
    ################################################## MIGRATION SETTINGS ###################################################
    # Specify the datastore you want to migrate from Skedler 4.x For example: sqlite, mysql, elasticsearch
    # migrationSourceDatastore: 'sqlite'
    # The path of the datastore you want to migrate from Skedler 4.x
    # migrationSourceDatastorePath: '/var/lib/skedler/skedler.db'
    # Base path of Skedler 4.x
    # oldSkedlerBasePath: '/var/lib/skedler'
    # Enable and configure only if you are using datastore as `mysql` in Skedler 4.x
    # migrationDatabaseHost: 'localhost'
    # migrationDatabasePort: 3306
    # migrationDatabaseName: skedler
    # migrationDatabaseUsername: 'admin'
    # migrationDatabasePassword: 'password'
    # migrationDialect: 'mysql'
    # Enable and configure only if you are using datastore as `elasticsearch` in Skedler 4.x
    # The Elasticsearch instance to use for all your queries.
    # elasticsearchUrl: "http://localhost:9200"
    # skedlerIndex: ".skedler"
    # If Elasticsearch uses security or basic auth like xpack, searcguard, opendistro etc, mention below.
    # elasticsearchAuthType: "xpack"
    # If Elasticsearch uses security or basic auth, add the security username and password here for Skedler.
    # skedlerElasticsearchUsername: user
    # skedlerElasticsearchPassword: pass


To deploy the configmap, execute the following command:

kubectl create -f skedler-configmap.yaml


Step 2: Create config files for datasources, notifications & orgs with the following content:


apiVersion: v1
kind: ConfigMap
metadata:
  name: skedler-datasources
  labels:
    app: skedler
data:
 datasources.yml: |
---
# # Datasources Provisioning
# datasources:
#     # name of the datasource. Required
#   - name: "Grafana-1"
#   # In org where skedler is going to create the datasource, the default is 'Main Org'. You can change it to your org name, If it is already created in skedler
#     org_name: "Main Org"
#     # datasource type. Required
#     type: "grafana"
#     data:
#       grafana_url: "http://localhost:3000"
#       auth_enabled: true
#       # Authentication type. Deafult is "basicAuth". You can change it as "apiKey" if you are using apikey for authentication
#       auth_type: "basicAuth"
#       auth_credentials:
#         grafana_username: "admin"
#         grafana_password: "admin"
#         apiKey: ""
#       grafana_ssl:
#         grafana_ssl_enabled: false
#         ssl_certificate: "/path/to/ssl_certificate"
#         ssl_key: "/path/to/ssl_key"
#         ssl_certificate_authorities: "/path/to/ca_certificate"


If you are using No Authentication or SSL the code can remain commented for  # Authentication type and # grafana_ssl: respectively


To Deploy the Configmap, execute following command:
kubectl create -f skedler-datasources.yaml



Repeat Step 2 to create a notifications config file with the below-mentioned content


apiVersion: v1
kind: ConfigMap
metadata:
  name: skedler-notifications
  labels:
    app: skedler
data:
 notifications.yml: |
---
# #Notifications Provisioning
# notifications:
#     # name of the notification channel. Required
#   - name: "Sendgrid"
#     # In org where skedler is going to create the notification channel, default is 'Main Org'. You can change it as your org name, If it is already created in skedler
#     org_name: "Main Org"
#     type: "mail"
#     config:
#       # Supported services are "Gmail","Outlook","SES","SES-US-EAST-1","SES-EU-EAST-1","SES-US-WEST-2","Others(Sendgrid)","Others"
#       service: "Others(Sendgrid)"
#       host: "smtp.sendgrid.net"
#       port: "587"
#       username: ""
#       password: ""
#       senderEmail: ""
#       adminMail: ""
#       ssl: false   
#     # name of the notification channel. Required
#   - name: "Slack-1"
#     # In org where skedler is going to create the notification channel, default is 'Main Org'. You can change it as your org name, If it is already created in skedler
#     org_name: "Main Org"
#     type: "slack"
#     config:
#       token: "xxxxx-xxxxxx-xxxxxx-xxxxx"
#       admin: "@xxxxx"


To Deploy the Configmap, execute following command:
kubectl create -f skedler-notifications.yaml


Again, Repeat Step 2 to create an orgs config file with the below-mentioned content.


apiVersion: v1
kind: ConfigMap
metadata:
  name: skedler-orgs
  labels:
    app: skedler
data:
 orgs.yml: |
---
# #Org Provisioning
# orgs: 
#   # name of the org to create in Skedler. Required
#   - name: First Org
#   - name: Second Org


To Deploy the Configmap, execute following command:
kubectl create -f skedler-orgs.yaml


Step 3: Updating the deployment file.

Create/update the skedler-deployment.yaml file as follows: (Note, Follow the highlighted commands if you're updating deployment file)


apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: skedler-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: skedler
  labels:
    app: skedler
spec:
  replicas: 1
  selector:
    matchLabels:
      app: skedler
  template:
    metadata:
      labels:
        app: skedler
    spec:
      containers:
      - name: skedler
        image: skedler/reports:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 3005
          protocol: TCP
        volumeMounts:
        - name: skedler-storage
          mountPath: /var/lib/skedler-xg
        - name: skedler-storage
          mountPath: /var/opt/skedler-xg
        - name: skedler-config
          mountPath: /usr/share/skedler-xg/reporting.yml
          subPath: reporting.yml
        - name: skedler-orgs 
mountPath: /usr/share/skedler-xg/provisioning/orgs/orgs.yml
subPath: orgs.yml
- name: skedler-datasources
mountPath: /usr/share/skedler-xg/provisioning/datasources/datasources.yml
subPath: datasources.yml
- name: skedler-notifications
mountPath: /usr/share/skedler-xg/provisioning/notifications/notifications.yml
subPath: notifications.yml
volumes: - name: skedler-storage       persistentVolumeClaim:          claimName: skedler-pvc - name: skedler-config configMap: name: skedler-config      - name: skedler-orgs
configMap:
name: skedler-orgs
- name: skedler-datasources
configMap:
name: skedler-datasources
- name: skedler-notifications
configMap:
name: skedler-notifications
--- apiVersion: v1 kind: Service metadata: name: skedler labels: app: skedler spec: selector: app: skedler ports: - port: 3005 protocol: TCP type: LoadBalancer


To deploy, execute the following command:

kubectl create -f skedler-deployment.yaml

Skedler will be deployed in the 3005 port.  


To view your deployment, execute the following command:

kubectl get deployments

You can get the service details by executing the following command: 

kubectl get services 



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article