# MetaKube Environment Setup

## Overview

At the end of this part you will be able to:

- set up a MetaKube cluster,
- prepare all necessary Resources for Authentication purposes on your CI/CD Pipeline.

## Introduction

We describe in the [Building Block Landscape Overview](<https://documentation.syseleven.de/en/prior-docs/metakube-accelerator/building-blocks/overview/index.md>) how a functional workflow and multiple components need to be provisioned.

The endpoint of a CI/CD pipeline is usually a runtime environment. For MetaKube Accelerator the defined runtime is a Kubernetes Cluster. The tutorial focuses on relevant aspects of the upcoming CI/CD pipeline, which needs some configuration items from the cluster. See further description of essential tasks to set up a Kubernetes Cluster appropriately from the description of the dedicated section. The description of the tasks required to set up a proper Kubernetes cluster is linked in the appropriate places

## Kubernetes Cluster Setup

For setting up a cluster, please refer to [MetaKube - Create a Cluster](<https://documentation.syseleven.de/en/prior-docs/metakube-core/how-to/create-a-cluster/index.md>). To deploy some of the Building Blocks, there is a minimum requirement of at least a [m1c.medium](<https://documentation.syseleven.de/en/prior-docs/openstack-cloud/reference/compute/index.md>) flavor for your nodes. We assume that you create a separate cluster for each environment (you choose what to use). Please make sure to either enable `Horizontal Node Autoscaling` or add enough [worker nodes](<https://documentation.syseleven.de/en/prior-docs/metakube-core/how-to/manage-node-deployments/index.md>) to satisfy your application's requirements.

## Kubernetes Authentication For Your CI/CD Pipeline (Kubeconfig)

For Authentication purposes, you can either use the role based Access Control(RBAC) or an external authentication Provider via OAuth2.

### Role Based Access Control

For RBAC-Permissions you can use your already defined [kubeconfig](<https://documentation.syseleven.de/en/prior-docs/metakube-core/how-to/downloading-the-kubeconfig/index.md>) or create a configured [kubeconfig suiting your needs](<https://kubernetes.io/docs/reference/access-authn-authz/rbac/>). Save the kubeconfig and encode it with base64

```sh
#for linux OS kubeconfig -> may vary as the name of the file matches your cluster name
cat ~/.kube/kubeconfig | base64 -w0 > pipeline_kubeconfig
#for macos / if you download the kubeconfig from your dashboard the file
#
cat <yourDownloadPathOfKubeConfig> | base64 > pipeline_kubeconfig
```
