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 Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

Kubernetes Job & CronJob Explained: API Resource, YAML Example, and Use Cases

Kubernetes Jobs and CronJobs Explained with Examples: Complete Hands-on Guide for DevOps Engineer Keywords 1. Introduction In Kubernetes, not every workload is a long-running application like a…

Read More

Kubernetes Secret Explained: Secret API Resource, YAML Example, and Use Cases

What is Kubernetes SecretsA Secret is an object that contains a small amount of sensitive data such as a password, a token, or a key. Objects of…

Read More

Kubernetes ConfigMap Explained: API Resource, YAML Example, and Use Cases

Content of reverseproxy.conf Commands to execute to create configmap Example pod using configmap Validating configmap inside a pod Rajesh Kumar I’m Rajesh Kumar, a DevOps, SRE, DevSecOps,…

Read More

Kubernetes Service Explained: API Resource, YAML Example, and Use Cases

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

Kubernetes Deployment Explained: API Resource, YAML Example, and Use Cases

Fearture of Kubernetes Deployment Note:ReplicaSets = Replication+Controller in the Deployment Kubernetes Deployement Strategy Type of deployment .spec.strategy specifies the strategy used to replace old Pods by new…

Read More

Kubernetes ReplicaSet Explained: API Resource, YAML Example, and Use Cases

Rajesh Kumar I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have…

Read More