Deploy your first Building Block

Step Goals

After this part you will be able to:

  • include your first Building Block,
  • configure a Building Block the way you need and want it,
  • deploy the Software Stack of a Building Block.

Introduction

After you set up your Kubernetes cluster and control repository it is now time to deploy the first Building Block.

As the Building Blocks are heavily optimized for production-ready environments, their interdependencies come naturally.
One of the core dependencies is the Observability Building Block. It ensures that following Building Blocks integrate automatically into your environment and can be added to your Monitoring and Logging seamlessly.

This Step will be explained by using the bash shell in unix like environments,
so we have a single window to work with. Please adapt to your needs accordingly.

As MetaKube Accelerator focuses on DevOps people, we expect you to have enough experience to work with the common tool set for administration tasks on unix.

Furthermore, we will use "syseleven" as Project and Company name, "showcase" as our control repository name as well as "development" as our environment.
Please configure this accordingly.

Integrate a Building Block into your control repository

If you haven't done it already, clone your control repository and add a suitable folder for the incoming building block:

# Make sure you are in a suitable directory for a new folder, clone your own control-repository
git clone git@code.syseleven.de:/syseleven/showcase

# When listing the files you should see the .gitlab-ci.yml you created on the previous step, e.g.
# -rw-r--r--   1 user  staff  1647  8 Feb 16:27 .gitlab-ci.yml

mkdir syseleven-kube-prometheus-stack

Add a .gitlab-ci.yml to this folder with the following content to include the JobDevelopment.yaml which includes the best practices for a development environment:

include:
  - project: syseleven/building-blocks/helmfiles/kube-prometheus-stack
    file: JobDevelopment.yaml
    ref: 34.0.0

Add a values-kube-prometheus-stack.yaml with the following content to specify all global settings:

prometheus:
  prometheusSpec:
    retention: 10d

Now include environment-specific settings in values-kube-prometheus-stack-development.yaml:

grafana:
  replicas: 1
  persistence:
    enabled: true
  adminPassword: $PASSWORD
  ingress:
    enabled: false

alertmanager:
  ingress:
    enabled: false

prometheus:
  prometheusSpec:
    resources:
      requests:
        memory: 500Mi
        cpu: 500m
      limits:
        memory: 2Gi
        cpu: "2"
    storageSpec:
      volumeClaimTemplate:
        spec:
          resources:
            requests:
              storage: 2Gi

After adding all these file your control repo should look like this:

/
└── syseleven-kube-prometheus-stack/
    ├── .gitlab-ci.yml
    ├── values-kube-prometheus-development.yaml
    └── values-kube-prometheus.yaml
.gitlab-ci.yml

Finally, you can include the .gitlab-ci.yml from your syseleven-kube-prometheus-stack to your CI/CD pipeline.

Your.gitlab-ci.yml in your root folder of your project workspace should now look like this:

stages:
  - diff
  - deploy

include:
  - /syseleven-kube-prometheus-stack/.gitlab-ci.yml

Now you can commit your changes and your pipeline will start testing and deploying your Building Block.

Just execute

git add .
git commit -m "add kube-prometheus-stack as building block"
git push

and watch the output of your pipeline on SysEleven Code!

building-block-pipeline

Further steps?

  • Show access to grafana/prometheus with port-forward
  • Deploy nginx and cert-manager
  • Enable ingress (this shows also how a BB config is updated)