Close
    logo                                         

    4 - Apps

    Building Applications

    This procedure explains how to build cSkyLab apps layer

    cskylab-layers-apps
    cskylab-layers-apps


    Deploy k8s-mod apps

    • From VS Code Remote connected to mcc, open terminal at k8s-mod folder repository
    • Check cluster status by customizing and running the following command:
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # k8s clusters status
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-mod/k8s-mod/ \
    && pwd \
    && echo \
    && direnv allow \
    && kubectl --kubeconfig=$HOME/.kube/config-k8s-mod get nodes \
    && echo \
    && kubectl --kubeconfig=$HOME/.kube/config-k8s-mod get pod --all-namespaces -o wide \
    && echo \
    && echo \
    && echo && echo "******** EOE - END of execution ********" && echo

    k8s-mod metallb / ingress-nginx / cert-manager

    • Deploy k8s-mod metallb / ingress-nginx / cert-manager applications by customizing and executing the following command:
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # k8s-mod base deployment
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-mod/k8s-mod/metallb-system/ \
    && direnv allow \
    && ./csdeploy.sh -qm pull-charts \
    && ./csdeploy.sh -qm install \
    && cd ${REPO_DIR}/cs-mod/k8s-mod/ingress-nginx/ \
    && direnv allow \
    && ./csdeploy.sh -qm pull-charts \
    && ./csdeploy.sh -qm install \
    && cd ${REPO_DIR}/cs-mod/k8s-mod/cert-manager/ \
    && direnv allow \
    && ./csdeploy.sh -qm pull-charts \
    && ./csdeploy.sh -qm install \
    && echo && echo "******** EOE - END of execution ********" && echo
    • Check for the complete deployment of cert-manager namespace, and deploy clusterissuers:
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Deploy clusterissuers
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-mod/k8s-mod/cert-manager/ \
    && ./csdeploy.sh -l \
    && ./csdeploy.sh -qm apply-cliss \
    && echo && echo "******** EOE - END of execution ********" && echo
    • Check cluster status by customizing and running the following command:
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # k8s clusters status
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-mod/k8s-mod/ \
    && pwd \
    && echo \
    && direnv allow \
    && kubectl --kubeconfig=$HOME/.kube/config-k8s-mod get nodes \
    && echo \
    && kubectl --kubeconfig=$HOME/.kube/config-k8s-mod get pod --all-namespaces -o wide \
    && echo \
    && echo \
    && echo && echo "******** EOE - END of execution ********" && echo

    k8s-mod harbor

    • Deploy Harbor by customizing and executing the following command:
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Deploy Harbor registry
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-mod/k8s-mod/harbor/ \
    && direnv allow \
    && ./csdeploy.sh -qm pull-charts \
    && ./csdeploy.sh -qm install \
    && echo && echo "******** EOE - END of execution ********" && echo
    • Check deployment status and WAIT for the complete deployment of Harbor registry

    Note: It is mandatory to have all pods up and running in harbor namespace to configure Harbor registry app.

    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Check harbor namespace status
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-mod/k8s-mod/harbor/ \
    && direnv allow \
    && ./csdeploy.sh -l \
    && echo && echo "******** EOE - END of execution ********" && echo

    Harbor registry initialization

    • Connect to the lab via VPN, navigate to https://harbor.cskylab.net and perform the procedures to Create private registry and Create dockerhub proxy as described in harbor how-to guides.

    Note: It is mandatory to initialize Harbor registry app before deploying any other application in k8s clusters.

    k8s-mod keycloak

    • From VS Code Remote connected to mcc, open terminal at k8s-mod folder repository
    • Check cluster status with kubectl get pod --all-namespaces
    • Deploy keycloak-theme-provider image by customizing and executing the following command:
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Deploy keycloak-theme-provider
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-mod/k8s-mod/keycloak/keycloak-theme-provider/ \
    && direnv allow \
    && ./csbuild.sh -qp \
    && echo && echo "******** EOE - END of execution ********" && echo
    • Deploy keycloak by customizing and executing the following command:
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Deploy keycloak
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-mod/k8s-mod/keycloak/ \
    && direnv allow \
    && ./csdeploy.sh -qm pull-charts \
    && ./csdeploy.sh -qm install \
    && echo && echo "******** EOE - END of execution ********" && echo
    • Check deployment status and wait until completed
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Check namespace status
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-mod/k8s-mod/keycloak/ \
    && direnv allow \
    && ./csdeploy.sh -l \
    && echo && echo "******** EOE - END of execution ********" && echo

    k8s-mod gitlab

    • From VS Code Remote connected to mcc, open terminal at k8s-mod folder repository
    • Check cluster status with kubectl get pod --all-namespaces
    • Deploy gitlab by customizing and executing the following command:
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Deploy gitlab
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-mod/k8s-mod/gitlab/ \
    && direnv allow \
    && ./csdeploy.sh -qm pull-charts \
    && ./csdeploy.sh -qm install \
    && echo && echo "******** EOE - END of execution ********" && echo
    • Perform gitlab rails-secret backup
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Save rail secrets to rail-secrets.yaml
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-mod/k8s-mod/gitlab/ \
    && direnv allow \
    && kubectl --kubeconfig=$HOME/.kube/config-k8s-mod -n=gitlab get secret gitlab-rails-secret -o jsonpath="{.data['secrets\.yml']}" | base64 --decode > rail-secrets.yaml \
    && ls ./rail-secrets.yaml \
    && echo && echo "******** EOE - END of execution ********" && echo

    Note: It is mandatory to save in gitlab folder repository the file rail-secrets.yaml. It is needed to fully restore your backups into another GitLab namespace.

    • Check deployment status and wait until completed
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Check namespace status
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-mod/k8s-mod/gitlab/ \
    && direnv allow \
    && ./csdeploy.sh -l \
    && echo && echo "******** EOE - END of execution ********" && echo

    k8s-mod nextcloud

    • From VS Code Remote connected to mcc, open terminal at k8s-mod folder repository
    • Check cluster status with kubectl get pod --all-namespaces
    • Deploy nextcloud by customizing and executing the following command:
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Deploy nextcloud
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-mod/k8s-mod/nextcloud/ \
    && direnv allow \
    && ./csdeploy.sh -qm pull-charts \
    && ./csdeploy.sh -qm install \
    && echo && echo "******** EOE - END of execution ********" && echo
    • Check deployment status and wait until completed
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Check namespace status
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-mod/k8s-mod/nextcloud/ \
    && direnv allow \
    && ./csdeploy.sh -l \
    && echo && echo "******** EOE - END of execution ********" && echo

    k8s-mod miniostalone

    • From VS Code Remote connected to mcc, open terminal at k8s-mod folder repository
    • Check cluster status with kubectl get pod --all-namespaces
    • Deploy miniostalone by customizing and executing the following command:
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Deploy miniostalone
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-mod/k8s-mod/miniostalone/ \
    && direnv allow \
    && ./csdeploy.sh -qm pull-charts \
    && ./csdeploy.sh -qm install \
    && echo && echo "******** EOE - END of execution ********" && echo
    • Check deployment status and wait until completed
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Check namespace status
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-mod/k8s-mod/miniostalone/ \
    && direnv allow \
    && ./csdeploy.sh -l \
    && echo && echo "******** EOE - END of execution ********" && echo

    k8s-mod minio-operator

    • From VS Code Remote connected to mcc, open terminal at k8s-mod folder repository
    • Check cluster status with kubectl get pod --all-namespaces
    • Deploy minio-operator by customizing and executing the following command:
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Deploy minio-operator
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-mod/k8s-mod/minio-operator/ \
    && direnv allow \
    && ./csdeploy.sh -qm pull-charts \
    && ./csdeploy.sh -qm install \
    && echo && echo "******** EOE - END of execution ********" && echo
    • Check deployment status and wait until completed
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Check namespace status
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-mod/k8s-mod/minio-operator/ \
    && direnv allow \
    && ./csdeploy.sh -l \
    && echo && echo "******** EOE - END of execution ********" && echo

    k8s-mod minio-tenant

    • From VS Code Remote connected to mcc, open terminal at k8s-mod folder repository
    • Check cluster status with kubectl get pod --all-namespaces
    • Deploy minio-tenant by customizing and executing the following command:
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Deploy minio-tenant
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-mod/k8s-mod/minio-tenant/ \
    && direnv allow \
    && ./csdeploy.sh -qm pull-charts \
    && ./csdeploy.sh -qm install \
    && echo && echo "******** EOE - END of execution ********" && echo
    • Check deployment status and wait until completed
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Check namespace status
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-mod/k8s-mod/minio-tenant/ \
    && direnv allow \
    && ./csdeploy.sh -l \
    && echo && echo "******** EOE - END of execution ********" && echo

    Deploy k8s-hello-mod application

    • Check cluster status with kubectl get pod --all-namespaces
    • Deploy hello-mod by customizing and executing the following command:
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Deploy hello
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-pro/k8s-pro/hello-mod/ \
    && direnv allow \
    && ./csdeploy.sh -qm install \
    && echo && echo "******** EOE - END of execution ********" && echo
    • Check deployment status and wait until completed
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Check namespace status
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-pro/k8s-pro/hello-mod/ \
    && direnv allow \
    && ./csdeploy.sh -l \
    && echo && echo "******** EOE - END of execution ********" && echo

    Deploy k8s-pro apps

    • From VS Code Remote connected to mcc, open terminal at k8s-pro folder repository
    • Check cluster status by customizing and running the following command:
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # k8s clusters status
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-pro/k8s-pro/ \
    && pwd \
    && echo \
    && direnv allow \
    && kubectl --kubeconfig=$HOME/.kube/config-k8s-pro get nodes \
    && echo \
    && kubectl --kubeconfig=$HOME/.kube/config-k8s-pro get pod --all-namespaces -o wide \
    && echo && echo "******** EOE - END of execution ********" && echo

    k8s-pro metallb / ingress-nginx / cert-manager

    • Deploy k8s-pro metallb / ingress-nginx / cert-manager applications by customizing and executing the following command:
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # k8s-pro base deployment
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-pro/k8s-pro/ \
    && direnv allow \
    && cd ${REPO_DIR}/cs-pro/k8s-pro/metallb-system/ \
    && direnv allow \
    && ./csdeploy.sh -qm pull-charts \
    && ./csdeploy.sh -qm install \
    && cd ${REPO_DIR}/cs-pro/k8s-pro/ingress-nginx/ \
    && direnv allow \
    && ./csdeploy.sh -qm pull-charts \
    && ./csdeploy.sh -qm install \
    && cd ${REPO_DIR}/cs-pro/k8s-pro/cert-manager/ \
    && direnv allow \
    && ./csdeploy.sh -qm pull-charts \
    && ./csdeploy.sh -qm install \
    && echo && echo "******** EOE - END of execution ********" && echo
    • Check for the complete deployment of cert-manager namespace, and deploy clusterissuers:
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Deploy clusterissuers
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-pro/k8s-pro/cert-manager/ \
    && ./csdeploy.sh -l \
    && ./csdeploy.sh -qm apply-cliss \
    && echo && echo "******** EOE - END of execution ********" && echo
    • Check cluster status with kubectl get pod --all-namespaces

    k8s-pro hello

    Personalize hello message

    • From VS Code Remote connected to mcc, open terminal at cs-pro/k8s-pro/hello folder repository

    • Edit file in cs-pro/k8s-pro/hello/mod-hello-kubernetes

    • Personalize the message value at the end of the file with your installation base url. Example:

      env:
      - name: MESSAGE
      value: Welcome to mpb-1100.cskylab.com k8s-pro cluster!

    Deploy k8s-hello application

    • Check cluster status with kubectl get pod --all-namespaces
    • Deploy hello by customizing and executing the following command:
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Deploy hello
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-pro/k8s-pro/ \
    && direnv allow \
    && cd ${REPO_DIR}/cs-pro/k8s-pro/hello/ \
    && direnv allow \
    && ./csdeploy.sh -qm install \
    && echo && echo "******** EOE - END of execution ********" && echo
    • Check deployment status and wait until completed
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Check namespace status
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-pro/k8s-pro/hello/ \
    && direnv allow \
    && ./csdeploy.sh -l \
    && echo && echo "******** EOE - END of execution ********" && echo

    Get k8s-hello letsencrypt-staging certificate

    • Edit file in cs-pro/k8s-pro/hello/mod-hello-kubernetes:
    • Set clusterissuer to letsencrypt-staging and save the file
    • Update deployment by running:
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Update deployment
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-pro/k8s-pro/hello/ \
    && direnv allow \
    && ./csdeploy.sh -qm update \
    && echo && echo "******** EOE - END of execution ********" && echo
    • Check deployment status and wait until completed (Usually less than 2 minutes)
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Check namespace status
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-pro/k8s-pro/hello/ \
    && direnv allow \
    && ./csdeploy.sh -l \
    && echo && echo "******** EOE - END of execution ********" && echo

    Get k8s-hello letsencrypt certificate (production)

    Note: It is mandatory to deploy succesfully letsencrypt-staging certificate, before attemting to deploy the production certificate.

    • Edit file in cs-pro/k8s-pro/hello/mod-hello-kubernetes:
    • Set clusterissuer to letsencrypt and save the file
    • Update deployment by running:
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Update deployment
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-pro/k8s-pro/hello/ \
    && direnv allow \
    && ./csdeploy.sh -qm update \
    && echo && echo "******** EOE - END of execution ********" && echo
    • Check deployment status and wait until completed (Usually less than 2 minutes)
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # Check namespace status
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-pro/k8s-pro/hello/ \
    && direnv allow \
    && ./csdeploy.sh -l \
    && echo && echo "******** EOE - END of execution ********" && echo
    • From your computer browser, without any VPN connected, navigate to your installation base url (Ex.:https://mpb-1110.cskylab.com) and check the letsencrypt production certificate.

    Finalize installation and tag the repo

    • Open terminal in root repository folder, commit changes and set a tag for first installation:
    # Tag repository
    git tag -a Initial_Install -m "Initial installation completed"
    # Push changes to origin
    git push origin --tags

    Check k8s-mod & k8s-pro clusters status

    • In your installation repository, go to root folder and check both cluster status by customizing and running the following command:
    # Set environment variables
    export REPO_DIR="$HOME/mpb-1100"
    # k8s clusters status
    echo && echo "******** SOE - START of execution ********" && echo \
    && cd ${REPO_DIR}/cs-mod/k8s-mod/ \
    && pwd \
    && echo \
    && direnv allow \
    && kubectl --kubeconfig=$HOME/.kube/config-k8s-mod get nodes \
    && echo \
    && kubectl --kubeconfig=$HOME/.kube/config-k8s-mod get pod --all-namespaces -o wide \
    && echo \
    && echo \
    && cd ${REPO_DIR}/cs-pro/k8s-pro/ \
    && pwd \
    && echo \
    && direnv allow \
    && kubectl --kubeconfig=$HOME/.kube/config-k8s-pro get nodes \
    && echo \
    && kubectl --kubeconfig=$HOME/.kube/config-k8s-pro get pod --all-namespaces -o wide \
    && echo && echo "******** EOE - END of execution ********" && echo

    License

    Copyright © 2021 cSkyLab.com ™

    Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.