Cloud Native Configurations for Kubernetes

CNCK

License Latest Release Go Report Card

CNCK = Cloud Native Configurations for Kubernetes

Make your Kubernetes applications more cloud native by injecting runtime cluster information into your ConfigMaps.

CNCK is a Kubernetes operator that renders text templates with simple JavaScript scriptlets that can query Kubernetes resources to pull data and generate contextual configuration text. It can continuously keep your configurations up to date. Couple it with the Reloader operator that will make sure to restart your components when the configurations change.

How It Works

An example of a ConfigMap with an embedded scriptlet to gather all running database pods and configure a loadbalancing connection to them:

apiVersion: v1
kind: ConfigMap
metadata:
  name: myapp
  annotations:
    cnck.github.com/render: myapp.yaml.template
    cnck.github.com/refresh: 1m
data:
  myapp.yaml.template: |
    log-file: /var/log/myapp.log
    database-url: <%
        let addresses = [];
        let databases = k8s.select({kind: 'Pod', labels: {app: 'mariadb'}});
        for (let d = 0; d < databases.length; d++)
            addresses.push(databases[d].status.podIP);
        write('jdbc:mariadb:loadbalance://' + addresses.join(',') + '/mydb');
    %>
  1. CNCK will detect the annotation and render the "myapp.yaml.template" data.
  2. The scriptlet embedded in the <% and %> delimiters will be run.
  3. The scriptlet selects pods according to labels, aggregates their IP addresses, and writes a JDBC connection string.
  4. CNCK will set the result in a new data key, without the .template extension, so the final result could look something like this:
apiVersion: v1
kind: ConfigMap
metadata:
  name: myapp
  annotations:
    cnck.github.com/render: myapp.yaml.template
    cnck.github.com/refresh: 1m
data:
  myapp.yaml: |
    log-file: /var/log/myapp.log
    database-url: jdbc:mariadb:loadbalance://10.244.0.54,10.244.0.76/mydb
  myapp.yaml.template: |
    ...
  1. The "refresh" annotation is set to 1 minute, so CNCK will re-render the template at that interval. It will only update the ConfigMap if the data has changed.
  2. An example of a Deployment that mounts this ConfigMap and has a Reloader annotation:
apiVersion: apps/v1
kind: Deployment
metadata:
  name: myapp
  annotations:
    reloader.stakater.com/auto: "true"
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: myapp
  template:
    metadata:
      labels:
        app.kubernetes.io/name: myapp
    spec:
      containers:
      - name: main
        image: myimage
        volumeMounts:
        - mountPath: /etc/myapp # will have a "myapp.yaml" file
          name: config
      volumes:
      - name: config
        configMap:
          name: myapp # the name of the ConfigMap to mount

See the examples directory for more information.

Installation

You can install the operator using this manifest as a template. For example:

curl -s https://raw.githubusercontent.com/tliron/cnck/main/assets/kubernetes/cnck-operator.yaml | NAMESPACE=default VERSION=1.0 envsubst | kubectl apply -f -
Similar Resources

The Cloud Native Application Proxy

The Cloud Native Application Proxy

Traefik (pronounced traffic) is a modern HTTP reverse proxy and load balancer that makes deploying microservices easy. Traefik integrates with your ex

Jan 9, 2023

Open Service Mesh (OSM) is a lightweight, extensible, cloud native service mesh that allows users to uniformly manage, secure, and get out-of-the-box observability features for highly dynamic microservice environments.

Open Service Mesh (OSM) is a lightweight, extensible, cloud native service mesh that allows users to uniformly manage, secure, and get out-of-the-box observability features for highly dynamic microservice environments.

Open Service Mesh (OSM) Open Service Mesh (OSM) is a lightweight, extensible, Cloud Native service mesh that allows users to uniformly manage, secure,

Jan 2, 2023

Zadig is a cloud native, distributed, developer-oriented continuous delivery product.

Zadig Developer-oriented Continuous Delivery Product English | 简体中文 Table of Contents Zadig Table of Contents What is Zadig Quick start How to use? Ho

Jan 8, 2023

Zadig is a cloud native, distributed, developer-oriented continuous delivery product.

Zadig Developer-oriented Continuous Delivery Product ⁣ English | 简体中文 Table of Contents Zadig Table of Contents What is Zadig Quick start How to use?

May 12, 2021

Interactive Cloud-Native Environment Client

Interactive Cloud-Native Environment Client

Fenix-CLI:Interactive Cloud-Native Environment Client English | 简体中文 Fenix-CLI is an interactive cloud-native operating environment client. The goal i

Dec 15, 2022

This is a cloud-native application that focuses on the DevOps area.

Get started Install KubeSphere via kk (or other ways). This is an optional step, basically we need a Kubernetes Cluster and the front-end of DevOps. I

Jan 5, 2023

Polaris is a cloud-native service discovery and governance center

It can be used to solve the problem of service connection, fault tolerance, traffic control and secure in distributed and microservice architecture.

Dec 26, 2022

cloud native application deploy flow

cloud native application deploy flow

Triton-io/Triton English | 简体中文 Introduction Triton provides a cloud-native DeployFlow, which is safe, controllable, and policy-rich. For more introdu

May 28, 2022

This is a cloud-native application that focuses on the DevOps area.

KubeSphere DevOps integrates popular CI/CD tools, provides CI/CD Pipelines based on Jenkins, offers automation toolkits including Binary-to-Image (B2I

Jan 5, 2023
Related tags
provide api for cloud service like aliyun, aws, google cloud, tencent cloud, huawei cloud and so on

cloud-fitter 云适配 Communicate with public and private clouds conveniently by a set of apis. 用一套接口,便捷地访问各类公有云和私有云 对接计划 内部筹备中,后续开放,有需求欢迎联系。 开发者社区 开发者社区文档

Dec 20, 2022
The OCI Service Operator for Kubernetes (OSOK) makes it easy to connect and manage OCI services from a cloud native application running in a Kubernetes environment.

OCI Service Operator for Kubernetes Introduction The OCI Service Operator for Kubernetes (OSOK) makes it easy to create, manage, and connect to Oracle

Sep 27, 2022
This repository contains Prowjob configurations for Amazon EKS Anywhere.

Amazon EKS Anywhere Prow Jobs This repository contains Prowjob configuration for the Amazon EKS Anywhere project, which includes the eks-anywhere and

Dec 19, 2022
Use Terraform to build and deploy configurations for Juniper SRX firewalls.
Use Terraform to build and deploy configurations for Juniper SRX firewalls.

Juniper Terraform - SRX Overview The goal of this project is to provide an example method to interact with Juniper SRX products with Terraform. ?? Ter

Mar 16, 2022
Kubernetes Operator for a Cloud-Native OpenVPN Deployment.

Meerkat is a Kubernetes Operator that facilitates the deployment of OpenVPN in a Kubernetes cluster. By leveraging Hashicorp Vault, Meerkat securely manages the underlying PKI.

Jan 4, 2023
Cloud Native Electronic Trading System built on Kubernetes and Knative Eventing

Ingenium -- Still heavily in prototyping stage -- Ingenium is a cloud native electronic trading system built on top of Kubernetes and Knative Eventing

Aug 29, 2022
Cloud-Z gathers information and perform benchmarks on cloud instances in multiple cloud providers.

Cloud-Z Cloud-Z gathers information and perform benchmarks on cloud instances in multiple cloud providers. Cloud type, instance id, and type CPU infor

Jun 8, 2022
Litmus helps Kubernetes SREs and developers practice chaos engineering in a Kubernetes native way.
Litmus helps Kubernetes SREs and developers practice chaos engineering in a Kubernetes native way.

Litmus Cloud-Native Chaos Engineering Read this in other languages. ???? ???? ???? ???? Overview Litmus is a toolset to do cloud-native chaos engineer

Jan 1, 2023
Cloud-on-k8s- - Elastic Cloud on Kubernetes (ECK)

Elastic Cloud on Kubernetes (ECK) Elastic Cloud on Kubernetes automates the depl

Jan 29, 2022
Kubernetes OS Server - Kubernetes Extension API server exposing OS configuration like sysctl via Kubernetes API

KOSS is a Extension API Server which exposes OS properties and functionality using Kubernetes API, so it can be accessed using e.g. kubectl. At the moment this is highly experimental and only managing sysctl is supported. To make things actually usable, you must run KOSS binary as root on the machine you will be managing.

May 19, 2021