The Kubernetes Inner Loop with Cloud Foundry Korifi

Certain developer workflows can be tedious. One example is working locally with containers. It brings to mind an old XKCD comic.
When working locally, the process of building and deploying containers can hinder the development experience and have a negative impact on team productivity. The industry refers to local workflows for developers as the “Inner Loop.” Cloud native development teams can greatly benefit from a reliable inner development loop framework. These frameworks facilitate the iterative coding process by automating repetitive tasks such as code building, containerization, and deployment to the target cluster.
Key expectations for an inner dev loop framework include:
- Automation of repetitive steps, such as code building, container creation, and deployment to the desired cluster;
- Seamless integration with both remote and local clusters, while providing support for local tunnel debugging in hybrid setups;
- Customizable workflows to enhance team productivity, allowing for the configuration of tailored processes based on team requirements.
Cloud native applications introduce additional responsibilities for developers, including handling external dependencies, containerization, and configuring orchestration tools such as Kubernetes YAML. These tasks increase the time involved in deployments and also introduce toil — ultimately hindering productivity.
In this tutorial, you will learn how to simplify inner-loop development workflows for your software development teams by making use of a Cloud Foundry abstraction over kind clusters. This abstraction named Korifi is fully open source and is expected to work for all languages and frameworks. Using Cloud Foundry Korifi will help developers push their source code to a cluster and the PaaS will return a URL/endpoint that the developer can then use to access the application or API.
Using ‘kind’ for Local Kubernetes
In the context of Kubernetes, a kind cluster refers to a lightweight, self-contained, and portable Kubernetes cluster that runs entirely within a Docker container. It is primarily used for local development and testing purposes. The main characteristics of kind clusters that make them suitable for local development are the following.
- Kind clusters consume fewer system resources compared to running a full-scale Kubernetes cluster.
- Kind clusters eliminate the need for complex cluster provisioning and configuration, making it easier to bootstrap a cluster.
- By matching the desired specifications, including the version of Kubernetes, network settings, and installed components — kind clusters provide a way to replicate production-like Kubernetes environments locally.
Installing Korifi on kind Clusters
First, please install the following tools before commencing the tutorial. They’re all required at various stages of the process.
- kubectl
- cf CLI v8.5 or greater
- Helm
- Docker desktop
- kbld
Set the following environment variables.
1 2 3 4 5 6 7 |
export ROOT_NAMESPACE="cf" export KORIFI_NAMESPACE="korifi-system" export ADMIN_USERNAME="kubernetes-admin" export BASE_DOMAIN="apps-127-0-0-1.nip.io" |
Note: nip.io is a wildcard DNS for any IP address. It is powered by PowerDNS with a simple, custom PipeBackend written in Python. In this particular case, apps-127-0-0-1.nip.io will resolve to 127.0.0.1, which will direct requests to the localhost.
Use the following configuration to create the kind cluster. The extraPortMappings field maps additional ports between the container and the host machine. Here, it specifies that container ports 80 and 443 should be mapped to the same host ports 80 and 443 respectively using TCP.
Create root namespaces that will be used in the cluster. It also includes labels for pod security policy enforcement.
Install the following dependencies: cert-manager, kpack, and Contour.
Cert manager is installed with a single kubectl apply command, with the latest release referenced in the path to the yaml definition.
1 |
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.12.0/cert-manager.yaml |
Cert manager is an open source certificate management solution designed specifically for Kubernetes clusters.
Kpack is installed with a single kubectl apply command, with the latest release referenced in the path to the yaml definition.
1 |
kubectl apply -f https://github.com/pivotal/kpack/releases/download/v0.11.0/release-0.11.0.yaml |
Kpack is an open source project that integrates with Kubernetes to provide a container-native build process. It consumes Cloud Native Buildpacks to export OCI-compatible containers.
Contour is an open source Ingress controller for Kubernetes that is built on top of the Envoy proxy. An Ingress controller is a Kubernetes resource that manages the inbound network traffic to services within a cluster. It acts as a gateway and provides external access to the services running inside the cluster.
1 |
kubectl apply -f https://projectcontour.io/quickstart/contour.yaml |
Contour specifically focuses on providing advanced features and capabilities for managing ingress in Kubernetes.
The installation requires a container registry to function. When using Korifi on a local kind cluster, the use of Docker Hub is recommended. In order to access this container registry, a secret will have to be created and configured.
Use the following Helm chart to install Korifi on the kind cluster.
Once installed, push an app using the following steps. First, authenticate with the Cloud Foundry API.
1 2 |
cf api https://api.localhost --skip-ssl-validation cf login |
Next, create a cf org and a cf space:
1 2 3 4 |
cf create-org acme-corp cf target -o acme-corp cf create-space -o acme-corp bu-rning cf target -o acme-corp -s bu-rning |
And finally, deploy the application:
1 |
cf push beautiful-bird -p ~/sandbox/korifi/tests/smoke/assets/test-node-app/ |
The single cf push command is used to deploy an application to the kind cluster that has Korifi installed on it.
An Alternate Way to Install
The community has contributed a script that will help install Korifi on a kind cluster. The use of this script will help speed things up considerably. This method is recommended if you’re trying Korifi for the first time.
1 2 3 |
git clone https://github.com/cloudfoundry/korifi.git cd korifi ./scripts/deploy-on-kind.sh demo-korifi |
When the installation completes, apps can be pushed using the same steps as above.
Why Pursue Efficiency in Local Development?
Local development is the first workflow that a developer always works with. It is paramount that this step be accurate and efficient in order to keep developers productive. While efficiency can vary depending on the specific development context. It’s essential to experiment with different approaches and tools to find what works best for your team and project.
An optimized build and deployment process is at the center of a good developer experience, and this is true for local environments too. Streamlined build and deployment pipelines go a long way in minimizing time spent which ensures faster iterations.
When using Kubernetes, Cloud Foundry Korifi is one way to make it faster and more efficient for software developers and operators to manage app lifecycles. We encourage you to give it a try and work with the community to make it better.