PCF (Pivotal Cloud Foundry) Interview Notes

1. What is PCF (Pivotal Cloud Foundry)?

PCF (Pivotal Cloud Foundry) is a Platform as a Service (PaaS) that enables developers to deploy, run, and manage applications without worrying about infrastructure.

Interview Answer: PCF is a cloud-native PaaS platform that abstracts infrastructure and allows developers to deploy applications quickly using simple commands like cf push.

2. PCF Architecture

Component Purpose
Cloud Controller Manages application lifecycle (push, start, stop)
Diego Schedules and runs application instances
Router (Gorouter) Routes HTTP/HTTPS requests to applications
UAA Authentication and Authorization
BOSH Deploys and manages PCF infrastructure
Loggregator Centralized logging and metrics collection
Interview Tip: Cloud Controller + Diego + Router + UAA + BOSH are the most commonly asked PCF architecture components.

3. What are Buildpacks?

Buildpacks are scripts used during application staging. They automatically detect application language/framework and prepare the runtime environment.

Examples:

Buildpacks detect the application type and install required runtime dependencies automatically.

4. How do you push an application to PCF?

cf push my-app

During deployment PCF:

  1. Uploads application
  2. Detects buildpack
  3. Stages application
  4. Creates droplet
  5. Deploys application instance
The cf push command deploys an application to PCF by staging and creating a droplet.

5. What is a Droplet?

A Droplet is the executable artifact generated after application staging.

A Droplet is similar to a container image and is used to run applications in PCF.

6. How does PCF handle scaling?

Vertical Scaling

cf scale my-app -m 1G

Increases application memory.

Horizontal Scaling

cf scale my-app -i 3

Increases number of application instances.

PCF supports both vertical scaling (memory) and horizontal scaling (instances).

7. What is a Service in PCF?

Services are external dependencies consumed by applications.

A service is an external resource provisioned through a Service Broker and bound to applications.

8. PCF vs Kubernetes

Feature PCF Kubernetes
Type PaaS Container Orchestration
Target Users Developers DevOps / Platform Teams
Deployment cf push kubectl apply
Infrastructure Management Hidden User Managed
Buildpacks Built-in Not Native
Learning Curve Easy Moderate to High
PCF focuses on developer productivity, while Kubernetes focuses on container orchestration and infrastructure management.

9. How does PCF handle Authentication and Authorization?

PCF uses UAA for authentication and role-based access through Organizations and Spaces.

10. How do you bind a Service to an Application?

cf bind-service my-app my-db-service

cf restage my-app

Service credentials become available through:

VCAP_SERVICES
Service binding injects credentials into the application via VCAP_SERVICES environment variable.

11. How do you view logs in PCF?

cf logs my-app --recent

cf logs my-app

Logs include:

12. How do you manage Environment Variables?

cf set-env my-app SPRING_PROFILES_ACTIVE prod

cf restart my-app
Environment variables are managed using cf set-env and become available to the application after restart.

13. What are Org and Space?

Component Description
Org Top-level business unit or project container
Space Environment within an Org (dev, test, prod)

Example:

Organization: Banking

  +-- Dev Space
  +-- QA Space
  +-- Prod Space
Org represents a business unit, while Space is used to separate environments within that organization.

14. Frequently Asked PCF Commands

cf login

cf target

cf apps

cf push my-app

cf start my-app

cf stop my-app

cf restart my-app

cf scale my-app -i 3

cf scale my-app -m 1G

cf logs my-app

cf env my-app

cf services

cf marketplace

cf bind-service my-app my-db

cf delete my-app

30-Second Interview Summary

PCF (Pivotal Cloud Foundry) is a Platform as a Service (PaaS) that allows developers to deploy applications quickly using cf push. Key components include Cloud Controller, Diego, Router, UAA, and BOSH. Buildpacks automatically prepare applications, droplets are the deployable artifacts, and services are bound through Service Brokers using VCAP_SERVICES. PCF abstracts infrastructure and focuses on developer productivity, while Kubernetes focuses on container orchestration and infrastructure management.