Skip to content

Instantly share code, notes, and snippets.

@pauldougan
Last active November 2, 2022 09:30
Show Gist options
  • Save pauldougan/81df7551d358fda9e7ead2f27a98081b to your computer and use it in GitHub Desktop.
Save pauldougan/81df7551d358fda9e7ead2f27a98081b to your computer and use it in GitHub Desktop.
Notes on Korifi

Notes on Korifi

Taking the first release v0.1.0 of korifi for a spin on a local single node kubernetes cluster. (FYI I recently tested this on 29th Sept 2022 with korifi v0.3.0 and these notes are still valid)

Not yet tested on v0.4.0 which brings helm packaging

TLDR; it can be installed in 14 minutes on a standard GDS macbook pro with 8GB of RAM

Refer to the official Hacking Guide from the korifi repo

Run a local Cloud Foundry on k8s, make some orgs/spaces, push some apps, create some services, check out the cf experience and take a look behind the scenes with kubectl.

Once installed you will have the following:

  • a local k8s cluster called kind-cf
  • an instance of korifi running cf on k8s
  • an cf endpoint at https://localhost
  • a default domain name of vcap.me
  • a local docker registry running in the cluster
  • the ability to use the cf cli
  • the ability to use the kubectl cli to explore the k8s back end and cf resources
  • the ability to cf create-org cf create-space cf push cf apps cf app

Tools

This is what I had installed to test, if you rerun this in the future the versions will have all changed.

what version decription
hardware 2.6 GHz 6-Core Intel Core i7 macbook pro
host os macos 11.6.6 host operating system
cf cli v8 8.3.0+e6f8a85.2022-03-11 latest cloud foundry CLI with k8s support
direnv v2.31.0 load environment variables based on directory
docker desktop 3.6.0 container runtime with 60Gb disk allocated, 8GB ram, 2GB swap
docker cli 20.10.8 docker command line interface
docker engine 20.10.8 docker engine
go 1.18.3 go langage
helm v3.8.2 k8s package manager
jq jq-1.6 json wrangling tool
kind v0.13.0 k8s on docker
korifi main repo
kubectl v1.24 k8s cli
kui 11.2.5 hybrid cli/gui for k8s
k9s v0.25.18 terminal cli tool for k8s
pack 0.26.0+git-04f7318.build-3309 packeto buildpacks CLI

Resources

Notes

assumes you already have Docker installed and you have given it 8GB or more RAM

  • docker preferences
  • resources

1. install some tools

brew install kubernetes-cli

brew install helm

brew install kustomize

brew install kubebuilder

brew install kind

brew install kui

brew install jq

brew install direnv

brew install cf-cli@8

brew install buildpacks/tap/pack

brew install k9s

2. install korifi on a local k8s cluster using kind

If you have an existing kind-cf cluster you should make sure that it is deleted before your proceed. Provisioning korifi throug the script into a pre-existing cluster results in a sitution where you will not be able to hit the api endpoint and configure cf correctly!

To ensure that there is no local cluster you should

kind get clusters

cf

kind delete cluster --name cf

git clone https://github.com/cloudfoundry/korifi

cd korifi

direnv allow

chmod a+rx ./scripts/deploy-on-kind.sh

creates a k8s cluster called cf using kind, a local docker registry, installs korifi + dependencies and creates a vcap.me domain

./scripts/deploy-on-kind.sh cf --default-domain --use-local-registry -v

asciicast

3. check the k8s installation

kubectl cluster-info

Kubernetes control plane is running at https://127.0.0.1:57546
CoreDNS is running at https://127.0.0.1:57546/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

docker ps

CONTAINER ID   IMAGE                  COMMAND                  CREATED          STATUS          PORTS                       NAMES
f3ed9a580afd   kindest/node:v1.23.4   "/usr/local/bin/entr…"   16 minutes ago   Up 16 minutes   127.0.0.1:64168->6443/tcp   cf-control-plane

kubectl version

Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.5", GitCommit:"c285e781331a3785a7f436042c65c5641ce8a9e9", GitTreeState:"clean", BuildDate:"2022-03-16T15:51:05Z", GoVersion:"go1.17.8", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.4", GitCommit:"e6c093d87ea4cbb530a7b2ae91e54c0842d8308a", GitTreeState:"clean", BuildDate:"2022-03-06T21:32:53Z", GoVersion:"go1.17.7", Compiler:"gc", Platform:"linux/amd64"}

kubectl config get-clusters

NAME
kind-cf

kubectl get namespaces

NAME                        STATUS   AGE
cert-manager                Active   6m36s
cf                          Active   6m38s
default                     Active   17m
eirini-controller           Active   5m56s
korifi-api-system           Active   2m8s
korifi-controllers-system   Active   2m49s
kpack                       Active   6m34s
kube-node-lease             Active   17m
kube-public                 Active   17m
kube-system                 Active   17m
local-path-storage          Active   17m
projectcontour              Active   6m27s
service-bindings            Active   5m52s

kubectl get nodes

NAME               STATUS   ROLES                  AGE     VERSION
cf-control-plane   Ready    control-plane,master   6h15m   v1.22.9

kubectl get crds -A

NAME                                                          CREATED AT
builders.kpack.io                                             2022-06-13T08:08:30Z
buildreconcilerinfos.korifi.cloudfoundry.org                  2022-06-13T08:09:19Z
builds.kpack.io                                               2022-06-13T08:08:30Z
buildworkloads.korifi.cloudfoundry.org                        2022-06-13T08:09:19Z
certificaterequests.cert-manager.io                           2022-06-13T08:08:12Z
certificates.cert-manager.io                                  2022-06-13T08:08:12Z
cfapps.korifi.cloudfoundry.org                                2022-06-13T08:09:20Z
cfbuilds.korifi.cloudfoundry.org                              2022-06-13T08:09:20Z
cfdomains.korifi.cloudfoundry.org                             2022-06-13T08:09:20Z
cforgs.korifi.cloudfoundry.org                                2022-06-13T08:09:20Z
cfpackages.korifi.cloudfoundry.org                            2022-06-13T08:09:20Z
cfprocesses.korifi.cloudfoundry.org                           2022-06-13T08:09:20Z
cfroutes.korifi.cloudfoundry.org                              2022-06-13T08:09:20Z
cfservicebindings.korifi.cloudfoundry.org                     2022-06-13T08:09:20Z
cfserviceinstances.korifi.cloudfoundry.org                    2022-06-13T08:09:20Z
cfspaces.korifi.cloudfoundry.org                              2022-06-13T08:09:20Z
cftasks.korifi.cloudfoundry.org                               2022-06-13T08:09:20Z
challenges.acme.cert-manager.io                               2022-06-13T08:08:13Z
clusterbuilders.kpack.io                                      2022-06-13T08:08:30Z
clusterissuers.cert-manager.io                                2022-06-13T08:08:13Z
clusterstacks.kpack.io                                        2022-06-13T08:08:30Z
clusterstores.kpack.io                                        2022-06-13T08:08:30Z
contourconfigurations.projectcontour.io                       2022-06-13T08:08:35Z
contourdeployments.projectcontour.io                          2022-06-13T08:08:35Z
extensionservices.projectcontour.io                           2022-06-13T08:08:35Z
httpproxies.projectcontour.io                                 2022-06-13T08:08:35Z
images.kpack.io                                               2022-06-13T08:08:30Z
issuers.cert-manager.io                                       2022-06-13T08:08:13Z
lrps.eirini.cloudfoundry.org                                  2022-06-13T08:08:37Z
orders.acme.cert-manager.io                                   2022-06-13T08:08:13Z
provisionedservices.bindings.labs.vmware.com                  2022-06-13T08:08:39Z
servicebindingprojections.internal.bindings.labs.vmware.com   2022-06-13T08:08:39Z
servicebindings.servicebinding.io                             2022-06-13T08:08:39Z
sourceresolvers.kpack.io                                      2022-06-13T08:08:30Z
tasks.eirini.cloudfoundry.org                                 2022-06-13T08:08:37Z
tlscertificatedelegations.projectcontour.io                   2022-06-13T08:08:35Z

NAME               STATUS   ROLES                  AGE   VERSION
cf-control-plane   Ready    control-plane,master   17m   v1.23.4

kubectl get cfdomains -A

NAMESPACE   NAME                                   DOMAIN NAME   AGE
cf          5b5032ab-7fc8-4da5-b853-821fd1879201   vcap.me       6h10m

kubectl get cforgs -A

NAMESPACE   NAME                                          DISPLAY NAME   AGE
cf          cf-org-dee26bae-f21a-4f6d-8e64-b3136ce08196   demo-org       145m

kubectl get cfspaces -A

NAMESPACE                                     NAME                                            DISPLAY NAME   AGE
cf-org-dee26bae-f21a-4f6d-8e64-b3136ce08196   cf-space-08a78eef-8f81-400d-9306-f3afec7304de   ruby           145m
cf-org-dee26bae-f21a-4f6d-8e64-b3136ce08196   cf-space-4427ee2e-b197-40a7-8dc1-75acd2f697cb   java           145m
cf-org-dee26bae-f21a-4f6d-8e64-b3136ce08196   cf-space-63fd3dbe-c4a9-48b0-958e-5705694d736a   sandbox        145m
cf-org-dee26bae-f21a-4f6d-8e64-b3136ce08196   cf-space-6d631ce8-47c6-47bf-837c-7b2e82e145d2   nodejs         145m
cf-org-dee26bae-f21a-4f6d-8e64-b3136ce08196   cf-space-80b0ca62-a7a6-47d8-a181-7534be99549d   gds            145m
cf-org-dee26bae-f21a-4f6d-8e64-b3136ce08196   cf-space-b48c4577-8b4b-43b4-91c0-03b684a4aae8   procfile       145m
cf-org-dee26bae-f21a-4f6d-8e64-b3136ce08196   cf-space-c8120b04-d07e-4c2a-b596-74214f621f98   go             124m

kubectl ger cfserviceinstances -A

NAMESPACE                                     NAME                                            DISPLAY NAME   AGE
cf-org-dee26bae-f21a-4f6d-8e64-b3136ce08196   cf-space-08a78eef-8f81-400d-9306-f3afec7304de   ruby           145m
cf-org-dee26bae-f21a-4f6d-8e64-b3136ce08196   cf-space-4427ee2e-b197-40a7-8dc1-75acd2f697cb   java           145m
cf-org-dee26bae-f21a-4f6d-8e64-b3136ce08196   cf-space-63fd3dbe-c4a9-48b0-958e-5705694d736a   sandbox        145m
cf-org-dee26bae-f21a-4f6d-8e64-b3136ce08196   cf-space-6d631ce8-47c6-47bf-837c-7b2e82e145d2   nodejs         145m
cf-org-dee26bae-f21a-4f6d-8e64-b3136ce08196   cf-space-80b0ca62-a7a6-47d8-a181-7534be99549d   gds            145m
cf-org-dee26bae-f21a-4f6d-8e64-b3136ce08196   cf-space-b48c4577-8b4b-43b4-91c0-03b684a4aae8   procfile       145m
cf-org-dee26bae-f21a-4f6d-8e64-b3136ce08196   cf-space-c8120b04-d07e-4c2a-b596-74214f621f98   go             124m

kubectl get po -A

NAMESPACE                   NAME                                                     READY   STATUS    RESTARTS        AGE
cert-manager                cert-manager-6888d6b69b-6vhfq                            1/1     Running   0               7m17s
cert-manager                cert-manager-cainjector-76f7798c9-8wzzg                  1/1     Running   0               7m17s
cert-manager                cert-manager-webhook-7d4b5d8484-v5v5r                    1/1     Running   0               7m17s
default                     localregistry-docker-registry-7bfc56bbc4-4wqzv           1/1     Running   0               7m32s
eirini-controller           eirini-controller-659b697958-6xwh9                       1/1     Running   0               6m34s
eirini-controller           eirini-controller-659b697958-xbtvc                       1/1     Running   0               6m34s
hnc-system                  hnc-controller-manager-78d658c559-r5qfs                  1/1     Running   1 (6m47s ago)   7m7s
korifi-api-system           korifi-api-deployment-67977ff85f-jddlm                   1/1     Running   0               2m49s
korifi-controllers-system   korifi-controllers-controller-manager-7cff958576-fzm4w   2/2     Running   0               3m30s
kpack                       kpack-controller-5f595b4fbd-qrhhj                        1/1     Running   0               7m16s
kpack                       kpack-webhook-54cdb674c7-kgx8p                           1/1     Running   0               7m15s
kube-system                 coredns-64897985d-b4pwk                                  1/1     Running   0               17m
kube-system                 coredns-64897985d-kx6fq                                  1/1     Running   0               17m
kube-system                 etcd-cf-control-plane                                    1/1     Running   0               17m
kube-system                 kindnet-8jdz2                                            1/1     Running   0               17m
kube-system                 kube-apiserver-cf-control-plane                          1/1     Running   0               17m
kube-system                 kube-controller-manager-cf-control-plane                 1/1     Running   0               17m
kube-system                 kube-proxy-zcjsr                                         1/1     Running   0               17m
kube-system                 kube-scheduler-cf-control-plane                          1/1     Running   0               17m
kube-system                 metrics-server-7766598ff7-8vlzx                          1/1     Running   0               6m32s
local-path-storage          local-path-provisioner-5ddd94ff66-8hrrh                  1/1     Running   0               17m
projectcontour              contour-6c5897cc5-84nhf                                  1/1     Running   0               7m9s
projectcontour              contour-6c5897cc5-rsrwg                                  1/1     Running   0               7m9s
projectcontour              envoy-qsr8h                                              2/2     Running   0               7m9s
service-bindings            manager-cd6699967-dw74l                                  1/1     Running   0               6m33s

k9s -A

asciicast

4. hop into the Docker back end

docker ps and grab the instance hash

CONTAINER ID   IMAGE                  COMMAND                  CREATED          STATUS          PORTS                       NAMES
f3ed9a580afd   kindest/node:v1.23.4   "/usr/local/bin/entr…"   18 minutes ago   Up 18 minutes   127.0.0.1:64168->6443/tcp   cf-control-plane

docker exec -ti f3ed9a580afd /bin/bash

top

top - 14:13:11 up 3 days,  1:11,  0 users,  load average: 0.48, 0.52, 0.79
Tasks:  83 total,   1 running,  82 sleeping,   0 stopped,   0 zombie
%Cpu(s):  3.8 us,  8.7 sy,  0.0 ni, 87.1 id,  0.1 wa,  0.0 hi,  0.3 si,  0.0 st
MiB Mem :   7960.4 total,    182.2 free,   1830.4 used,   5947.8 buff/cache
MiB Swap:   2048.0 total,   1698.1 free,    349.9 used.   5660.1 avail Mem

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
    637 root      20   0 1471640 649912  60648 S  23.6   8.0  11:38.77 kube-apiserver
    526 root      20   0   10.8g 103004  38696 S  10.6   1.3   5:07.48 etcd
    724 root      20   0 2173832 102176  50716 S   7.0   1.3   4:06.76 kubelet
    626 root      20   0  768796 104392  47628 S   6.0   1.3   2:31.70 kube-controller
   1839 root      20   0  751096  43872  32456 S   2.7   0.5   0:10.60 coredns
   4918 1000      20   0  746052  46656  29404 S   2.0   0.6   1:02.60 manager
   2104 root      20   0 1868032  74204  34264 S   1.3   0.9   2:33.82 containerd
   3052 1000      20   0  743172  37308  26200 S   1.3   0.5   0:11.74 webhook
   3327 1000      20   0 1283264  69776  31132 S   1.3   0.9   0:26.24 webhook
   5272 65532     20   0  744956  43740  28384 S   1.3   0.5   0:24.48 manager
    570 root      20   0  754528  53564  36424 S   0.7   0.7   0:21.42 kube-scheduler
   2785 1000      20   0  808428  77016  25380 S   0.7   0.9   0:26.32 cainjector
   4217 1000      20   0  743212  60504  27712 S   0.7   0.7   0:22.70 manager
   4767 1001      20   0  735864  36396  23500 S   0.7   0.4   0:16.47 eirini-controll
   1718 root      20   0  138984  25716  20796 S   0.3   0.3   0:07.15 local-path-prov
   1949 root      20   0  751096  43888  32328 S   0.3   0.5   0:10.47 coredns
   3241 1000      20   0 1393380  70164  41564 S   0.3   0.9   0:19.35 controller
   3766 nobody    20   0  746720  46876  30752 S   0.3   0.6   0:04.31 contour
   4354 nobody    20   0 2318828  55064  36324 S   0.3   0.7   0:17.80 envoy
   5019 1000      20   0  752212  47720  33312 S   0.3   0.6   0:19.33 metrics-server
   5618 root      20   0  713292   9592   6672 S   0.3   0.1   0:02.11 containerd-shim
   6151 root      20   0    7176   3344   2780 R   0.3   0.0   0:00.03 top
      1 root      20   0   16552  10588   7764 S   0.0   0.1   0:00.33 systemd
    172 root      19  -1   21444   8812   8112 S   0.0   0.1   0:00.26 systemd-journal
    351 root      20   0  713292   9304   6672 S   0.0   0.1   0:02.29 containerd-shim
    352 root      20   0  713036   9500   6608 S   0.0   0.1   0:02.02 containerd-shim
    359 root      20   0  713036  10004   7116 S   0.0   0.1   0:02.40 containerd-shim
    361 root      20   0  713292   8932   6548 S   0.0   0.1   0:02.27 containerd-shim
    434 65535     20   0     972      4      0 S   0.0   0.0   0:00.02 pause
    438 65535     20   0     972      4      0 S   0.0   0.0   0:00.02 pause
    449 65535     20   0     972      4      0 S   0.0   0.0   0:00.03 pause
    455 65535     20   0     972      4      0 S   0.0   0.0   0:00.02 pause
   1095 root      20   0  713292   9620   6864 S   0.0   0.1   0:02.49 containerd-shim
   1121 root      20   0  713036   9540   6732 S   0.0   0.1   0:02.26 containerd-shim
   1142 65535     20   0     972      4      0 S   0.0   0.0   0:00.03 pause
   1150 65535     20   0     972      4      0 S   0.0   0.0   0:00.01 pause
   1203 root      20   0  733716  26004  19380 S   0.0   0.3   0:02.16 kindnetd
   1280 root      20   0  748680  40576  30972 S   0.0   0.5   0:03.18 kube-proxy
   1667 root      20   0  713036   9384   6672 S   0.0   0.1   0:01.96 containerd-shim
   1687 65535     20   0     972      4      0 S   0.0   0.0   0:00.03 pause
   1767 root      20   0  713036   9532   6804 S   0.0   0.1   0:02.31 contai

add some tools

apt-get update

root@cf-control-plane:/# apt-get update
Get:1 http://security.ubuntu.com/ubuntu impish-security InRelease [110 kB]
Get:2 http://security.ubuntu.com/ubuntu impish-security/restricted amd64 Packages [336 kB]
Get:3 http://archive.ubuntu.com/ubuntu impish InRelease [270 kB]
Get:4 http://security.ubuntu.com/ubuntu impish-security/main amd64 Packages [429 kB]
Get:5 http://security.ubuntu.com/ubuntu impish-security/multiverse amd64 Packages [1699 B]
Get:6 http://security.ubuntu.com/ubuntu impish-security/universe amd64 Packages [231 kB]
Get:7 http://archive.ubuntu.com/ubuntu impish-updates InRelease [115 kB]
Get:8 http://archive.ubuntu.com/ubuntu impish-backports InRelease [101 kB]
Get:9 http://archive.ubuntu.com/ubuntu impish/restricted amd64 Packages [110 kB]
Get:10 http://archive.ubuntu.com/ubuntu impish/universe amd64 Packages [16.7 MB]
Get:11 http://archive.ubuntu.com/ubuntu impish/main amd64 Packages [1793 kB]
Get:12 http://archive.ubuntu.com/ubuntu impish/multiverse amd64 Packages [256 kB]
Get:13 http://archive.ubuntu.com/ubuntu impish-updates/multiverse amd64 Packages [8745 B]
Get:14 http://archive.ubuntu.com/ubuntu impish-updates/restricted amd64 Packages [344 kB]
Get:15 http://archive.ubuntu.com/ubuntu impish-updates/main amd64 Packages [516 kB]
Get:16 http://archive.ubuntu.com/ubuntu impish-updates/universe amd64 Packages [284 kB]
Get:17 http://archive.ubuntu.com/ubuntu impish-backports/universe amd64 Packages [5198 B]
Fetched 21.7 MB in 3s (7887 kB/s)
Reading package lists... Done

apt-get -y install vim jq

kubectl get pods -A

NAMESPACE                   NAME                                                    READY   STATUS    RESTARTS      AGE
cert-manager                cert-manager-6888d6b69b-5qtlr                           1/1     Running   0             42m
cert-manager                cert-manager-cainjector-76f7798c9-7fr4s                 1/1     Running   0             42m
cert-manager                cert-manager-webhook-7d4b5d8484-2glgt                   1/1     Running   0             42m
default                     localregistry-docker-registry-76f97665c-4dcw6           1/1     Running   0             42m
eirini-controller           eirini-controller-659b697958-hpjhw                      1/1     Running   0             42m
eirini-controller           eirini-controller-659b697958-x9fcm                      1/1     Running   0             42m
hnc-system                  hnc-controller-manager-78d658c559-vx4lt                 1/1     Running   1 (42m ago)   42m
korifi-api-system           korifi-api-deployment-7565576844-nxg85                  1/1     Running   0             40m
korifi-controllers-system   korifi-controllers-controller-manager-6b75478b9-nsntw   2/2     Running   0             41m
kpack                       kpack-controller-5f595b4fbd-sg8nw                       1/1     Running   0             42m
kpack                       kpack-webhook-54cdb674c7-6bxnn                          1/1     Running   0             42m
kube-system                 coredns-64897985d-9dwlz                                 1/1     Running   0             43m
kube-system                 coredns-64897985d-hrbp2                                 1/1     Running   0             43m
kube-system                 etcd-cf-control-plane                                   1/1     Running   0             43m
kube-system                 kindnet-8w7wc                                           1/1     Running   0             43m
kube-system                 kube-apiserver-cf-control-plane                         1/1     Running   0             43m
kube-system                 kube-controller-manager-cf-control-plane                1/1     Running   0             43m
kube-system                 kube-proxy-tb6xg                                        1/1     Running   0             43m
kube-system                 kube-scheduler-cf-control-plane                         1/1     Running   0             43m
kube-system                 metrics-server-7766598ff7-bjhlg                         1/1     Running   0             42m
local-path-storage          local-path-provisioner-5ddd94ff66-hkbfr                 1/1     Running   0             43m
projectcontour              contour-6c5897cc5-gqtng                                 1/1     Running   0             42m
projectcontour              contour-6c5897cc5-xlzqd                                 1/1     Running   0             42m
projectcontour              envoy-6tvbr                                             2/2     Running   0             42m
service-bindings            manager-cd6699967-thzr2                                 1/1     Running   0             42m

5. Set up API endpoint and login

back on the host system take a look at the cf api endpoint

note the use of -k to ignore cert warning and -L for redirection

curl -skL  https://localhost | jq .
{
  "links": {
    "app_ssh": null,
    "bits_service": null,
    "cloud_controller_v2": null,
    "cloud_controller_v3": {
      "href": "https://localhost/v3",
      "meta": {
        "version": "3.111.0+cf-k8s"
      }
    },
    "credhub": null,
    "log_cache": {
      "href": "https://localhost",
      "meta": {
        "version": ""
      }
    },
    "log_stream": null,
    "logging": null,
    "login": null,
    "network_policy_v0": null,
    "network_policy_v1": null,
    "routing": null,
    "self": {
      "href": "https://localhost",
      "meta": {
        "version": ""
      }
    },
    "uaa": null
  },
  "cf_on_k8s": true
}
curl -skL https://localhost/v3 | jq .
{
  "links": {
    "self": {
      "href": "https://localhost/v3"
    }
  }
}

cf api --skip-ssl-validation https://localhost

Setting API endpoint to https://localhost...
OK

API endpoint:   https://localhost
API version:    3.111.0+cf-k8s

Not logged in. Use 'cf login' or 'cf login --sso' to log in.

cf login

cf login
API endpoint: https://localhost

1. cf-admin
2. kind-cf

Choose your Kubernetes authentication info (enter to skip): 1

Authenticating...
OK

Targeted org foo.

API endpoint:   https://localhost
API version:    3.111.0+cf-k8s
user:           cf-admin
org:            foo
space:          No space targeted, use 'cf target -s SPACE'

asciicast

6. check buildpacks

cf buildpacks

Getting buildpacks as kubernetes-admin...

position   name                         stack                         enabled   locked   filename
1          paketo-buildpacks/java       io.buildpacks.stacks.bionic   true      false    paketo-buildpacks/java@6.18.0
2          paketo-buildpacks/go         io.buildpacks.stacks.bionic   true      false    paketo-buildpacks/go@1.3.1
3          paketo-buildpacks/nodejs     io.buildpacks.stacks.bionic   true      false    paketo-buildpacks/nodejs@0.13.0
4          paketo-buildpacks/ruby       io.buildpacks.stacks.bionic   true      false    paketo-buildpacks/ruby@0.12.0
5          paketo-buildpacks/procfile   io.buildpacks.stacks.bionic   true      false    paketo-buildpacks/procfile@5.1.0

7. create an org and a space


GDS11172:GitHub pauldougan$ cf login
API endpoint: https://localhost

1. cf-admin
2. kind-cf

Choose your Kubernetes authentication info (enter to skip): 1

Authenticating...
OK

API endpoint:   https://localhost
API version:    3.111.0+cf-k8s
user:           cf-admin
No org or space targeted, use 'cf target -o ORG -s SPACE'

cf create-org demo-org

Creating org demo-org as cf-admin...
OK

TIP: Use 'cf target -o "demo-org"' to target new org

cf t -o demo-org

API endpoint:   https://localhost
API version:    3.111.0+cf-k8s
user:           cf-admin
org:            demo-org
No space targeted, use 'cf target -s SPACE'

cf create-space sandbox

OK

Assigning role SpaceManager to user cf-admin in org demo-org / space sandbox as cf-admin...
OK

Assigning role SpaceDeveloper to user cf-admin in org demo-org / space sandbox as cf-admin...
OK

cf t -s sandbox

API endpoint:   https://localhost
API version:    3.111.0+cf-k8s
user:           cf-admin
org:            demo-org

cf t

API endpoint:   https://localhost
API version:    3.111.0+cf-k8s
user:           cf-admin
org:            demo-org
space:          sandbox

check out via kubectl

kubectl get namespaces

NAME                                            STATUS   AGE
cert-manager                                    Active   58m
cf                                              Active   58m
cf-org-0b318ccd-a978-459c-844b-62c17476b895     Active   2m28s
cf-space-89d2858c-2adf-4a7c-951d-5bb64439720d   Active   74s
default                                         Active   59m
eirini-controller                               Active   57m
hnc-system                                      Active   58m
korifi-api-system                               Active   56m
korifi-controllers-system                       Active   57m
kpack                                           Active   58m
kube-node-lease                                 Active   59m
kube-public                                     Active   59m
kube-system                                     Active   59m
local-path-storage                              Active   59m
projectcontour                                  Active   58m
service-bindings                                Active   57m

note that the newly created org has cf-org-[uuid] for a name

asciicast

10. get some sample apps to test with

The paketo samples have a variety of useful simple sample apps to test with

git clone https://github.com/paketo-buildpacks/samples paketo-buildpacks && cd paketo-buildpacks

git clone https://github.com/paketo-buildpacks/samples paketo-samples && cd paketo-samples
Cloning into 'paketo-samples'...
remote: Enumerating objects: 4113, done.
remote: Counting objects: 100% (143/143), done.
remote: Compressing objects: 100% (117/117), done.
remote: Total 4113 (delta 40), reused 97 (delta 20), pack-reused 3970
Receiving objects: 100% (4113/4113), 148.20 MiB | 26.37 MiB/s, done.
Resolving deltas: 100% (2183/2183), done.
Updating files: 100% (1084/1084), done.

asciicast

11. push static content

cd procfile/procfile-sample

cf push procfile -m 128M

cf apps

cf app procfile

cf logs static --recent

note that logs is currently not implemented

12. scale app up and down

cf scale -i 3 procfile

cf apps

check k8s backend using k9s

13. push a golang app

14. push a nodejs app

15. push a ruby app

16. push a java app

17. push a python app

not currently supported out of the box

17. push a php app

not currently supported out of the box

18. push a dotnet core app

not currently supported out of the box

19. install a GOV.UK prototype (nodejs)

note that we need to set a username and passwork for basic authentication

git clone https://github.com/alphagov/govuk-prototype-kit
cd govuk-prototype-kit
cf push govuk-prototype-kit --var USERNAME user --var PASSWORD password

then visit https://govuk-prototype-kit.vcap.me with your browser (you will need to enter user and password when prompted), Firefox allows you to view the page which uses a self signed TLS certificate, Chrome seems to be a bit picky and refuses to render the page.

20. user provisioned services

This shows how to create two user defined services.

cf create-user-provided-service SAAS-KEYS -p '{"username":"admin","password":"SECRETPWD!"}'

cf create-user-provided-service API-TOKEN -p '{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"}'


21. tasks

not yet comppletely supported

22. Add the kubernetes dashboard

add the k8s dashboard to the cluster

see the official documentation

install dashboard

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.5.0/aio/deploy/recommended.yaml

add user account and role binding

@pauldougan
Copy link
Author

Add example binding an app to a use provided service

@pauldougan
Copy link
Author

add additional buildpacks for

  • python
  • php
  • nginx
  • dotnet-core
  • web servers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment