Kubernetes Cluster Management

Guide for creating and managing Kubernetes clusters using PKS (Pivotal Container Service).

Table of Contents

Overview

This document covers the process of creating and managing Kubernetes clusters using PKS (now VMware Tanzu Kubernetes Grid Integrated Edition). PKS provides enterprise-grade Kubernetes with automated provisioning, scaling, and lifecycle management.

Key Benefits

  • Automated Provisioning: Consistent cluster deployment
  • Enterprise Security: RBAC and network policies
  • High Availability: Multi-master cluster configurations
  • Monitoring: Integrated observability tools

Prerequisites

Required Access

  • PKS API endpoint access
  • Valid PKS user credentials
  • Network connectivity to cluster endpoints

Required Tools

  • PKS CLI
  • kubectl
  • Certificate authority certificate

Install PKS CLI

Download PKS CLI and kubectl from Pivnet, move it to /usr/local/bin and chmod 755.

# Download from Pivotal Network
# Move binaries to system path
sudo mv pks /usr/local/bin/
sudo mv kubectl /usr/local/bin/

# Make executable
sudo chmod 755 /usr/local/bin/pks
sudo chmod 755 /usr/local/bin/kubectl

# Verify installation
pks --version
kubectl version --client

Create Cluster

Step 1: Authenticate with PKS API

# Load environment credentials
source "./scripts/set-om-creds.sh"

# Extract PKS CA certificate
om credentials \
  -p pivotal-container-service \
  --credential-reference .pivotal-container-service.pks_tls \
  --credential-field cert_pem > /tmp/pks-ca.crt

# Login to PKS API
pks login -a api.pks.markalston.net --ca-cert /tmp/pks-ca.crt -u malston

Step 2: Create Kubernetes Cluster

# Create cluster with external hostname
pks create-cluster tibanna \
  --external-hostname tibanna.markalston.net \
  --plan small

# Monitor cluster creation progress
watch -n 60 pks clusters

Step 3: Configure kubectl Access

# Get cluster credentials
pks get-credentials tibanna

# Verify cluster connectivity
kubectl cluster-info
kubectl get nodes

Cluster Management

View Available Clusters

# List all clusters
pks clusters

# Get detailed cluster information
pks cluster tibanna

Scale Cluster

# Resize cluster (requires cluster plan support)
pks resize tibanna --num-nodes 5

Delete Cluster

# Delete cluster (irreversible)
pks delete-cluster tibanna

Troubleshooting

Common Issues

Issue: PKS Login Fails

Symptoms:

  • Certificate verification errors
  • Authentication failures

Solution:

# Verify CA certificate
openssl x509 -in /tmp/pks-ca.crt -text -noout

# Check API endpoint connectivity
curl -k https://api.pks.markalston.net:9021/v1/info

Issue: Cluster Creation Stuck

Symptoms:

  • Cluster stuck in “creating” state
  • Timeout during provisioning

Solution:

# Check BOSH deployments
bosh deployments

# View cluster creation logs
bosh -d service-instance_[cluster-id] logs

Log Locations

  • PKS API logs: Available through BOSH director
  • Cluster logs: kubectl logs -n kube-system
  • BOSH deployment logs: bosh logs

References

Internal Documentation

External Documentation


Last Updated: 2025-01-11 Maintained by: Mark Alston


This project is for educational and home lab purposes.