Skip to Content
Technical Articles
Author's profile photo Sandeep Menon

SAP Business Technology Platform(BTP), Kubernetes – YAML configuration file

In last blog the components of Kubernetes were explained. Here I will share my understanding how these components are created and configured in Kubernetes? .yaml file helps in creating components in DEPLOYMENT. When trying to understand the file at first it may appear as complex, but the file is logically structured and easy to understand.

Sample YAML file can be downloaded from git repository

in the path file is present “/xf-application-mocks/commerce-mock/deployment/k8s.yaml”

Reference: – Developers Tutorial – Kyma. The above git hub is taken as reference from SAP Developers tutorial.

Each component of Kubernetes has its configuration file. These configuration files are stored in the code. Configuration file mainly has 4 parts.

  1. apiVersion
  2. kind
  3. metadata
  4. spec

YAML is available for many programming languages and file can be validated and verified using many YAML Validator tools available online.

 

  • apiVersion – this holds the version
  • kind – For what component of Kubernetes, whether it is DEPLOYMENT, SERVICE, VOLUME, etc…
  • metadata – metadata of the component.
  • spec – configuration that needs to be applied for the component. Attributes here will be specific to the kind of component

The above image shows a sample .yaml file with configuration for Kubernetes components DEPLOYMENT, SERVICE, VOLUME.

The kind identifies the Kubernetes component.

Below is the configuration of Kubernetes component DEPLOYMENT. Here there is configuration file inside configuration file, metadata & spec mentioned below attribute template of spec. This is the configuration of the POD. DEPLOYMENT manages POD.

 

The connection between the component of Kubernetes app is by labels & selectors. The metadata part contains the label and spec part contains the selector. The components connect with each other using the selector app attributes with same values.

In the below image selector app attribute has value “commerce-mock” creates connection between component DEPLOYMENT and SERVICE.

 

These configuration files help in Kubernetes components connections between each other like SERVICE will understand which POD belong to it. Similarly, other components configuration can be understood.

Assigned tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.