Eirini Controller is a Kubernetes controller that aims to enable Cloud Foundry to deploy applications as Pods on a Kubernetes cluster. It brings the CF model to Kubernetes by definig well known Diego abstractions such as Long Running Processes (LRPs) and Tasks as custom Kubernetes resources.
kubectl create ns eirini-controller
kubectl create ns cf-workloads
curl https://raw.githubusercontent.com/cloudfoundry/eirini-controller/master/deployment/scripts/generate-secrets.sh | bash -s - "*.eirini-controller.svc"
In ordrer to install eirini-controller to your k8s cluster, run the command below,
replacing x.y.z
with a valid release version
VERSION=x.y.z; \
WEBHOOK_CA_BUNDLE="$(kubectl get secret -n eirini-controller eirini-webhooks-certs -o jsonpath="{.data['tls\.ca']}")"; \
helm install eirini-controller https://github.com/cloudfoundry/eirini-controller/releases/download/v$VERSION/eirini-controller-$VERSION.tgz \
--namespace eirini-controller \
--set "webhooks.ca_bundle=$WEBHOOK_CA_BUNDLE"
cat <<EOF | kubectl apply -f -
apiVersion: eirini.cloudfoundry.org/v1
kind: LRP
metadata:
name: mylrp
namespace: cf-workloads
spec:
GUID: $(uuidgen)
diskMB: 256
image: eirini/dorini
EOF
You can see the resources created by eirini by running
kubectl get all -n cf-workloads
A statefulset
and a pod
should appear. Eirini does not provide a network layer,
so if you want to access your LRP you have to do it from within the cluster or
use telepresence.
POD_IP=$(kubectl get pod -n cf-workloads --selector=korifi.cloudfoundry.org/source-type=APP -o jsonpath="{.items[0].status.podIP}")
telepresence --run curl http://$POD_IP:8080/ 2>/dev/null
cat <<EOF | kubectl apply -f -
apiVersion: eirini.cloudfoundry.org/v1
kind: Task
metadata:
name: mytask
namespace: cf-workloads
spec:
GUID: $(uuidgen)
image: eirini/busybox
command: ["/bin/echo", "Hello!"]
EOF
In order to see the greeting message, run the following command
kubectl logs -n cf-workloads --selector=korifi.cloudfoundry.org/source-type=TASK