<p><strong>IMPORTANT</strong>: After uninstalling MicroK8s, it is convenient to reboot the computer (the VM if you work on a VM, or the physical computer if you use a physical computer). Otherwise, there are system configurations that are not correctly cleaned. Especially in what port forwarding and firewall rules matters.</p>
<p>After the reboot, redeploy as it is described in this section.</p>
<p><strong>Important</strong>: The original H2020-TeraFlow project hosted on GitLab.com has been
archieved and will not receive further contributions/updates.
Please, clone from <ahref="https://labs.etsi.org/rep/tfs/controller">ETSI-hosted GitLab code repository</a>.</p>
<h3><u>Checkout the appropriate Git branch</h3>
<p></u>
TeraFlowSDN controller versions can be found in the appropriate release tags and/or branches as described in <ahref="/Home#versions">Home > Versions</a>.</p>
<p>By default the branch <em>master</em> is checked out and points to the latest stable version of the TeraFlowSDN controller, while branch <em>develop</em> contains the latest developments and contributions under test and validation.</p>
<p>To switch to the appropriate branch run the following command, changing <code>develop</code> by the name of the branch you want to deploy:</p>
<pre><codeclass="language-bash">cd ~/tfs-ctrl
git checkout develop
</code></pre>
<h3><u>Prepare a deployment script with the deployment settings</h3>
<p></u>
Create a new deployment script, e.g., <code>my_deploy.sh</code>, adding the appropriate settings as
follows.
This section provides just an overview of the available settings. An example <ahref="https://labs.etsi.org/rep/tfs/controller/-/blob/master/my_deploy.sh"><code>my_deploy.sh</code></a> script is provided in the root folder of the project for your convenience with full description of all the settings.</p>
<p><strong>Note</strong>: The example <code>my_deploy.sh</code> script provides reasonable settings for deploying a functional and complete enough TeraFlowSDN controller, and a brief description of their meaning. To see extended descriptions, check scripts in the <code>deploy</code> folder.</p>
- <code>TFS_REGISTRY_IMAGE</code> enables to specify the private Docker registry to be used, by default, we assume to use the Docker respository enabled in MicroK8s.
- <code>TFS_COMPONENTS</code> specifies the components their Docker image will be rebuilt, uploaded to the private Docker registry, and deployed in Kubernetes.
- <code>TFS_IMAGE_TAG</code> defines the tag to be used for Docker images being rebuilt and uploaded to the private Docker registry.
- <code>TFS_K8S_NAMESPACE</code> specifies the name of the Kubernetes namespace to be used for deploying the TFS components.
- <code>TFS_EXTRA_MANIFESTS</code> enables to provide additional manifests to be applied into the Kubernetes environment during the deployment. Typical use case is to deploy ingress controllers, service monitors for Prometheus, etc.
- <code>TFS_GRAFANA_PASSWORD</code> lets you specify the password you want to use for the <code>admin</code> user of the Grafana instance being deployed and linked to the Monitoring component.
- <code>TFS_SKIP_BUILD</code>, if set to <code>YES</code>, prevents rebuilding the Docker images. That means, the deploy script will redeploy existing Docker images without rebuilding/updating them.</p>
<ul>
<li>Section <code>CockroachDB</code>: enables to configure the deployment of the backend <ahref="https://www.cockroachlabs.com/">CockroachDB</a> database.</li>
<li>
<p>Check example script <ahref="https://labs.etsi.org/rep/tfs/controller/-/blob/master/my_deploy.sh"><code>my_deploy.sh</code></a> for further details.</p>
</li>
<li>
<p>Section <code>NATS</code>: enables to configure the deployment of the backend <ahref="https://nats.io/">NATS</a> message broker.</p>
</li>
<li>
<p>Check example script <ahref="https://labs.etsi.org/rep/tfs/controller/-/blob/master/my_deploy.sh"><code>my_deploy.sh</code></a> for further details.</p>
</li>
<li>
<p>Section <code>QuestDB</code>: enables to configure the deployment of the backend <ahref="https://questdb.io/">QuestDB</a> timeseries database.</p>
</li>
<li>Check example script <ahref="https://labs.etsi.org/rep/tfs/controller/-/blob/master/my_deploy.sh"><code>my_deploy.sh</code></a> for further details.</li>
</ul>
<h3><u>Confirm that MicroK8s is running</h3>
<p></u></p>
<p>Run the following command:</p>
<pre><codeclass="language-bash">microk8s status
</code></pre>
<p>If it is reported <code>microk8s is not running, try microk8s start</code>, run the following command to start MicroK8s:</p>
<pre><codeclass="language-bash">microk8s start
</code></pre>
<p>Confirm everything is up and running:</p>
<ol>
<li>Periodically <ahref="/1.-Deployment-Guide/1.2.-Install-MicroK8s#check-status-of-kubernetes-and-addons">Check the status of Kubernetes</a> until you see the addons [dns, ha-cluster, helm3, hostpath-storage, ingress, registry, storage] in the enabled block.</li>
<li>Periodically <ahref="/1.-Deployment-Guide/1.2.-Install-MicroK8s#check-all-resources-in-kubernetes">Check Kubernetes resources</a> until all pods are <strong>Ready</strong> and <strong>Running</strong>.</li>
</ol>
<h3><u>Deploy TFS controller</h3>
<p></u>
First, source the deployment settings defined in the previous section.
This way, you do not need to specify the environment variables in each and every command you execute to operate the TFS controller.
Be aware to re-source the file if you open new terminal sessions.
Then, run the following command to deploy TeraFlowSDN controller on top of the MicroK8s Kubernetes platform.</p>
<pre><codeclass="language-bash">cd ~/tfs-ctrl
source my_deploy.sh
./deploy/all.sh
</code></pre>
<p>The script performs the following steps:
- Executes script <code>./deploy/crdb.sh</code> to automate deployment of CockroachDB database used by Context component.
- The script automatically checks if CockroachDB is already deployed.
- If there are settings instructing to drop the database and/or redeploy CockroachDB, it does the appropriate actions to honor them as defined in previous section.
- Executes script <code>./deploy/nats.sh</code> to automate deployment of NATS message broker used by Context component.
- The script automatically checks if NATS is already deployed.
- If there are settings instructing to redeploy the message broker, it does the appropriate actions to honor them as defined in previous section.
- Executes script <code>./deploy/qdb.sh</code> to automate deployment of QuestDB timeseries database used by Monitoring component.
- The script automatically checks if QuestDB is already deployed.
- If there are settings instructing to redeploy the timeseries database, it does the appropriate actions to honor them as defined in previous section.
- Executes script <code>./deploy/tfs.sh</code> to automate deployment of TeraFlowSDN.
- Creates the namespace defined in <code>TFS_K8S_NAMESPACE</code>
- Creates secrets for CockroachDB, NATS, and QuestDB to be used by Context and Monitoring components.
- Builds the Docker images for the components defined in <code>TFS_COMPONENTS</code>
- Tags the Docker images with the value of <code>TFS_IMAGE_TAG</code>
- Pushes the Docker images to the repository defined in <code>TFS_REGISTRY_IMAGE</code>
- Deploys the components defined in <code>TFS_COMPONENTS</code>
- Creates the file <code>tfs_runtime_env_vars.sh</code> with the environment variables for the components defined in <code>TFS_COMPONENTS</code> defining their local host addresses and their port numbers.
- Applies extra manifests defined in <code>TFS_EXTRA_MANIFESTS</code> such as:
- Creating an ingress controller listening at port 80 for HTTP connections to enable external access to the TeraFlowSDN WebUI, Grafana Dashboards, and Compute NBI interfaces.
- Deploying service monitors to enable monitoring the performance of the components, device drivers and service handlers.
- Initialize and configure the Grafana dashboards (if Monitoring component is deployed)
- Report a summary of the deployment
- See <ahref="./1.5.-Show-Deployment-and-Logs">Show Deployment and Logs</a></p>
<h2id="14-webui-and-grafana-dashboards"><strong>1.4. WebUI and Grafana Dashboards</strong></h2>
<h2id="15-show-deployment-and-logs"><strong>1.5. Show Deployment and Logs</strong></h2>