Comparing Kubernetes to Pivotal Cloud Foundry — A Developer’s Perspective

Oded Shopen
Dec 29, 2017 · 21 min read


Overview

Cloud Foundry

Kubernetes

Similarities

PaaS vs IaaS+

Cloud Foundry

Kubernetes

Supported Containers

Kubernetes

Running nodejs and Mongo DB in a docker container

Cloud Foundry


Management Console

Cloud Foundry

Kubernetes

Command Line Interface

Cloud Foundry

cf push myapp -p myapp.jar
wabelhlp0655019:test odedia$ cf push myapp -p myapp.jarUpdating app myapp in org OdedShopen / space production as user…OKUploading myapp…Uploading app files from: /var/folders/_9/wrmt9t3915lczl7rf5spppl597l2l9/T/unzipped-app271943002Uploading 977.4K, 148 filesDone uploadingOKStarting app myapp in org OdedShopen / space production as user…
Downloading pcc_php_buildpack…
Downloading binary_buildpack…
Downloading python_buildpack…
Downloading staticfile_buildpack…
Downloading java_buildpack…
Downloaded binary_buildpack (61.6K)
Downloading ruby_buildpack…
Downloaded ruby_buildpack
Downloading nodejs_buildpack…
Downloaded pcc_php_buildpack (951.7K)
Downloading go_buildpack…
Downloaded staticfile_buildpack (7.7M)
Downloading ibm-websphere-liberty-buildpack…
Downloaded nodejs_buildpack (111.6M)
Downloaded ibm-websphere-liberty-buildpack (178.4M)
Downloaded java_buildpack (224.8M)
Downloading php_buildpack…
Downloading dotnet_core_buildpack…
Downloaded python_buildpack (341.6M)
Downloaded go_buildpack (415.1M)
Downloaded php_buildpack (341.7M)
Downloaded dotnet_core_buildpack (919.8M)
Creating container
Successfully created container
Downloading app package…
Downloaded app package (40.7M)
Staging…
— — -> Java Buildpack Version: v3.18 |
https://github.com/cloudfoundry/java-buildpack.git#841ecb2
— — -> Downloading Open Jdk JRE 1.8.0_131 from https://java-buildpack.cloudfoundry.org/openjdk/trusty/x86_64/openjdk-1.8.0_131.tar.gz (found in cache)
Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.1s)
— — -> Downloading Open JDK Like Memory Calculator 2.0.2_RELEASE from https://java-buildpack.cloudfoundry.org/memory-calculator/trusty/x86_64/memory-calculator-2.0.2_RELEASE.tar.gz (found in cache)Memory Settings: -Xmx681574K -XX:MaxMetaspaceSize=104857K -Xss349K -Xms681574K -XX:MetaspaceSize=104857K
— — -> Downloading Container Security Provider 1.5.0_RELEASE from https://java-buildpack.cloudfoundry.org/container-security-provider/container-security-provider-1.5.0_RELEASE.jar (found in cache) — — -> Downloading Spring Auto Reconfiguration 1.11.0_RELEASE from https://java-buildpack.cloudfoundry.org/auto-reconfiguration/auto-reconfiguration-1.11.0_RELEASE.jar (found in cache)Exit status 0
Uploading droplet, build artifacts cache…
Uploading build artifacts cache…
Uploading droplet…
Staging complete
Uploaded build artifacts cache (109B)
Uploaded droplet (86.2M)
Uploading complete
Destroying container
Successfully destroyed container
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
1 of 1 instances running
applications:
- name: my-app
memory: 512M
instances: 2
env:
PARAM1: PARAM1VALUE
PARAM2: PARAM2VALUE

Kubernetes

# start the pod running nginx
$ kubectl run --image=nginx nginx-app --port=80 --env="DOMAIN=cluster"
deployment "nginx-app" created
# expose a port through with a service
$ kubectl expose deployment nginx-app --port=80 --name=nginx-http
service "nginx-http" exposed
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: test-ingress
annotations:
ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- http:
paths:
- path: /testpath
backend:
serviceName: test
servicePort: 80
kubectl create -f my-ingress.yaml
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80

Zero Downtime Deployments

Cloud Foundry

cf map-route myApp-v2 mysite.com —hostname myApp

Kubernetes

kubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=jon/kubernetes-bootcamp:v2
kubectl rollout undo deployments/kubernetes-bootcamp

External Load Balancing

Kubernetes

ingress → service → pod → container

Cloud Foundry

route → container

Internal Load Balancing (Service Discovery)

Cloud Foundry

Kubernetes

GET https://my-service/myApi
GET https://my-service.zone1/myApi

Marketplace

Kubernetes

Configuration

Storage Volumes

Onboarding

Kubernetes

Cloud Foundry

Vision

Kubernetes

Cloud Foundry

PKS

Conclusion

Oded Shopen

Written by

Sr. Platform Architect @pivotal . I enjoy 📷, 🎥 editing, and the 🎵 of the King of Pop. Views are my own. http://odedia.org

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade