Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

Getting Started with Cloud Foundry for Kubernetes using cf-for-k8s in Linux(Ubuntu)

Step 1- Install the cf CLI Using a Package Manager


# Add the Cloud Foundry Foundation public key and package repository to your system by running:
$ wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add -
$ echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list

# Update your local package index by running:
sudo apt-get update

# To install cf CLI v7, run:
sudo apt-get install cf7-cli

$ cf version
$ cf --helpCode language: PHP (php)

Step 2- You will need kubectl to interact with your cluster kubectl install instructions


# Download the latest release with the command:
$ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"

# Install kubectl
$ sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

$ kubectl
kubectl version --clientCode language: PHP (php)

Step 3 – KinD (Kubernetes in Docker) to instantiate your local cluster


$ curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64
$ chmod +x ./kind
$ mv ./kind /usr/local/bin/kind
$ kind version
$ kindCode language: JavaScript (javascript)

Step 4 – Install Bosh CLI

Bosh CLI the ./hack/generate-values.sh script will use the Bosh CLI to generate certificates, keys, and passwords in the file ./cf-install-values.yml


$ wget https://github.com/cloudfoundry/bosh-cli/releases/download/v6.4.4/bosh-cli-6.4.4-linux-amd64
$ chmod +x ./bosh
$ mv bosh-cli-6.4.4-linux-amd64 bosh
$ sudo mv ./bosh /usr/local/bin/bosh
$ bosh Code language: JavaScript (javascript)

Step 5- kapp (v0.21.0+) will aid you to deploy cf-for-k8s to your cluster


$ wget -O- https://carvel.dev/install.sh | bash
# or with curl...
$ curl -L https://carvel.dev/install.sh | bash
$ kapp --versionCode language: PHP (php)

Step 6- ytt (v0.26.0+) will help create templates to deploy cf-for-k8s


$ wget https://github.com/vmware-tanzu/carvel-ytt/releases/download/v0.35.1/ytt-linux-amd64
$ mv ytt-linux-amd64 ytt
$ chmod +x ./ytt
$ sudo mv ./ytt /usr/local/bin/ytt
$ ytt versionCode language: JavaScript (javascript)

Step 7- DockerHub is the image registry used in this guide please make an account if you don’t have one they are free and quickly made.


Username - devopsschools
Password/Token - 

Step 8- Clone cf-for-k8s github repo


git clone https://github.com/cloudfoundry/cf-for-k8s.git && cd cf-for-k8sCode language: PHP (php)

Step 9- Install Docker


apt install docker.ioCode language: CSS (css)

Step 10 – Create a kubernetes cluster of version of v1.20.2


# Review ./deploy/kind/cluster.yml
$ kind create cluster --config=./deploy/kind/cluster.yml --image kindest/node:v1.20.2

# Latest kubernetes cluster but its not working with v1.21.X
$ kind create cluster --config=./deploy/kind/cluster.yml

$ kubectl cluster-info --context kind-kind
$ kubectl config use-context
$ kubectl --context kind-kind get nodes
$ kubectl --context kind-kind get pods --all-namespacesCode language: PHP (php)

Step 11 – Generate the yaml used to deploy CF for k8s


$ ./hack/generate-values.sh -d vcap.me > ./cf-install-values.yml

WARNING: The hack scripts are intended for development of cf-for-k8s.
  They are not officially supported product bits.  Their interface and behavior
  may change at any time without notice.Code language: PHP (php)

Step 12 – Append the app_registry credentials to your DockerHub registry to the bottom of the ./cf-install-values.yml replacing with your information. You can copy/paste or use the following command.


cat >> cf-install-values.yml << EOL
app_registry:
  hostname: https://index.docker.io/v1/
  repository_prefix: "devopsschools"
  username: "devopsschools"
  password: "d6b938ab-4bf2-4b49-b7c9-ddddddddd"
EOLCode language: JavaScript (javascript)

Step 13 – There are a few more lines to add to your cf-install-values.yml, like adding a metrics server because KinD doesn’t come with one.


cat >> cf-install-values.yml << EOL
add_metrics_server_components: true
enable_automount_service_account_token: true
metrics_server_prefer_internal_kubelet_address: true
remove_resource_requirements: true
use_first_party_jwt_tokens: true


load_balancer:
  enable: false
EOLCode language: JavaScript (javascript)

Step 14 – Now, use cf-install-values.yml to render the final Kubernetes template to raw Kubernetes configuration.


$ ytt -f config -f ./cf-install-values.yml > ./cf-for-k8s-rendered.yml

Step 15 – Deploy CF for k8s


You are ready to deploy cf-for-k8s using the ./cf-for-k8s-rendered.yml file created above. Once you deploy it should take around 10 minutes to finish.

$ kapp deploy -a cf -f ./cf-for-k8s-rendered.yml -y
$ kapp listCode language: PHP (php)

Step 16 – Validate the deployment & Create and target an organization and space.



Target your CF CLI to point to the new CF instance.

$ cf api --skip-ssl-validation https://api.vcap.me

Set the CF_ADMIN_PASSWORD environment variable to the CF administrative password, stored in the cf_admin_password key in the configuration-values/deployment-values.yml file:

$ CF_ADMIN_PASSWORD="$(bosh interpolate ./cf-install-values.yml --path /cf_admin_password)"

Log into the installation as the admin user.

$ cf auth admin "$CF_ADMIN_PASSWORD"

Enable Docker

$ cf enable-feature-flag diego_docker

A powerful feature provided by CF is multi-tenancy, where you can create a space for a team, an app or whatever your workflow requires.

Create and target an organization and space.

$ cf create-org test-org
$ cf create-space -o test-org test-space
$ cf target -o test-org -s test-spaceCode language: JavaScript (javascript)

Step 17 – Deploy an application with cf push


At last you can push the included sample test-node-app.

$ cf push test-node-app -p ./tests/smoke/assets/test-node-app

Or you can push any app you wish just cd into the directory and push the app with the following command.

$ cf push APP-NAME

Once your app stages you can find it in Cloud Foundry with this command.

$ cf apps

The output in the terminal should look something as follows.

Getting apps in org test-org / space test-space as admin...
OK

name            requested state   instances   memory   disk   urls
test-node-app   started           1/1         1G       1G     test-node-app.vcap.me
To see the pods that have applications on your Cloud Foundry instance look in the cf-workloads namespace.

$ kubectl get pods -n cf-workloads

# Access using https
curl -k https://test-node-app.apps.vcap.me
Code language: JavaScript (javascript)

Step 18 – Deploy another application with cf push


$ git clone https://github.com/cloudfoundry-samples/test-app.git
$ cd test-app
$ cf push test-app

# Access using following urls

curl -k https://test-node-app.apps.vcap.me
curl -k https://test-app-grumpy-wallaby-gi.apps.vcap.me
curl -k https://test-app-grumpy-wallaby-gi.apps.vcap.me/env
curl -k https://test-app-grumpy-wallaby-gi.apps.vcap.me/exit
curl -k https://test-app-grumpy-wallaby-gi.apps.vcap.me/index
curl -k https://test-app-grumpy-wallaby-gi.apps.vcap.me/port
Code language: PHP (php)

Last: Delete the cf-for-k8s deployment & Kind cluster


$ kapp delete -a cf
$ kind delete cluster

Code language: JavaScript (javascript)

Reference

  • https://tanzu.vmware.com/developer/guides/kubernetes/cf4k8s-gs/
  • https://cf-for-k8s.io/docs/
  • https://katacoda.com/cloudfoundry-tutorials/scenarios/trycf

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I have worked at <a href="https://www.cotocus.com/">Cotocus</a>. I share tech blog at <a href="https://www.devopsschool.com/">DevOps School</a>, travel stories at <a href="https://www.holidaylandmark.com/">Holiday Landmark</a>, stock market tips at <a href="https://www.stocksmantra.in/">Stocks Mantra</a>, health and fitness guidance at <a href="https://www.mymedicplus.com/">My Medic Plus</a>, product reviews at <a href="https://www.truereviewnow.com/">TrueReviewNow</a> , and SEO strategies at <a href="https://www.wizbrand.com/">Wizbrand.</a> Do you want to learn <a href="https://www.quantumuting.com/">Quantum Computing</a>? <strong>Please find my social handles as below;</strong> <a href="https://www.rajeshkumar.xyz/">Rajesh Kumar Personal Website</a> <a href="https://www.youtube.com/TheDevOpsSchool">Rajesh Kumar at YOUTUBE</a> <a href="https://www.instagram.com/rajeshkumarin">Rajesh Kumar at INSTAGRAM</a> <a href="https://x.com/RajeshKumarIn">Rajesh Kumar at X</a> <a href="https://www.facebook.com/RajeshKumarLog">Rajesh Kumar at FACEBOOK</a> <a href="https://www.linkedin.com/in/rajeshkumarin/">Rajesh Kumar at LINKEDIN</a> <a href="https://www.wizbrand.com/rajeshkumar">Rajesh Kumar at WIZBRAND</a> <a href="https://www.rajeshkumar.xyz/dailylogs">Rajesh Kumar DailyLogs</a>

Related Posts

List of containerized storage orchestration in Kubernetes

List of Containerized Storage Orchestration Solutions in Kubernetes (2026 Edition) Kubernetes has become excellent at orchestrating stateless applications, but stateful workloads still need a proper storage layer….

Read More

Understanding Authentication & Authorization in kubernetes

Authentication – How User’s access should be allowed? The process or action of verifying the identity of a user or process.Authorization – What Access and till what…

Read More

Kubernetes 1.23.6 Cluster Setup Master and Worker in Ubuntu 20.04

Latest doc – https://github.com/certifications-tutorials/kubernetes-cluster-setup Following commands would help you to create 1 Master and 1 Node in same VM. Run Following commands in Master Node Run following…

Read More

Kubernetes PersistentVolume, PersistentVolumeClaim, volume using hostPath

pv.yaml $ kubectl create -f pv.yaml $ kubectl get pv pvc.yaml $ kubectl create -f pvc.yaml $ kubectl get pvc pod.yaml Rajesh Kumar I’m a DevOps/SRE/DevSecOps/Cloud Expert…

Read More

Kubernetes: Working with ReplicationController

A ReplicationController is a Kubernetes controller that ensures that a specified number of pod replicas are running at any one time. In other words, a ReplicationController makes…

Read More

Kubernetes Tutorials: Pod Load balancing using Service

In Kubernetes, a Service is an abstraction that defines a logical set of pods and a policy by which to access them. It provides a stable network…

Read More