# Worker K8S

> K3S cluster configuration, kubectl patterns, and registry information

- Skill: `eron1703/worker-k8s` (Agent Skill)
- Install (CLI): `npx skillmds@latest add eron1703/worker-k8s`
- Raw SKILL.md: https://api.skillmd.com/api/skills/eron1703/worker-k8s/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Author: eron1703 (https://skillmd.com/u/eron1703)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/eron1703/worker-k8s

---


# Worker K8S Knowledge

## K3S Cluster

### Cluster Info
- **Type**: K3S (single-node Kubernetes)
- **Namespaces**: flowmaster, flowmaster-test, flowmaster-dev, databases-test (query commander-mcp for current list)

### Access Pattern
Always SSH first, then run kubectl on the remote server:
```bash
ssh dev-01-root "kubectl -n flowmaster get pods"
ssh dev-01-root "kubectl -n flowmaster describe pod <pod-name>"
```

## Local Docker Registry

### Registry Details
- **URL**: localhost:30500 (accessible from the server only)
- **Type**: K3S NodePort registry
- **Authentication**: None (private network)

### Image Build and Push Workflow
```bash
# 1. Build image on server
docker build --platform linux/amd64 -t localhost:30500/flowmaster/<name>:<tag> .

# 2. Push to registry
docker push localhost:30500/flowmaster/<name>:<tag>

# 3. Deploy/update in K8S
kubectl set image -n flowmaster deploy/<name> <name>=localhost:30500/flowmaster/<name>:<tag>
```

## Kubectl Common Commands

### Pod Management
```bash
# List pods
ssh dev-01-root "kubectl -n flowmaster get pods"

# Describe pod
ssh dev-01-root "kubectl describe pod -n flowmaster <pod-name>"

# Check logs
ssh dev-01-root "kubectl logs -n flowmaster deploy/<service> --tail=50"

# Get logs from specific pod
ssh dev-01-root "kubectl logs -n flowmaster <pod-name> --tail=100"
```

### Deployment Management
```bash
# List deployments
ssh dev-01-root "kubectl -n flowmaster get deploy"

# Update image
ssh dev-01-root "kubectl set image -n flowmaster deploy/<name> <name>=localhost:30500/flowmaster/<name>:<tag>"

# Restart deployment
ssh dev-01-root "kubectl rollout restart -n flowmaster deploy/<name>"

# Check deployment status
ssh dev-01-root "kubectl -n flowmaster describe deploy <name>"
```

### ConfigMaps
```bash
# List ConfigMaps
ssh dev-01-root "kubectl get cm -n flowmaster"

# View specific ConfigMap
ssh dev-01-root "kubectl get cm gateway-config -n flowmaster -o yaml"

# Edit ConfigMap
ssh dev-01-root "kubectl edit cm gateway-config -n flowmaster"
```

### Service Discovery
```bash
# List services
ssh dev-01-root "kubectl -n flowmaster get svc"

# Get service endpoints
ssh dev-01-root "kubectl -n flowmaster get endpoints"
```

## Health Checks

### Via kubectl exec
```bash
ssh dev-01-root "kubectl exec -n flowmaster deploy/<name> -- wget -qO- http://localhost:<port>/health"
```

### Common Health Endpoints
- Most services: `/health`
- API Gateway: `/health`
- WebSocket Gateway: `/health`

## ClusterIP Endpoints

**WARNING**: ClusterIPs are dynamic and will change if services are recreated. Always look them up live:
```bash
ssh dev-01-root "kubectl -n flowmaster get svc"
```

These are used in Nginx config: `/etc/nginx/sites-enabled/flowmaster`

## Image Pull Policy
- All K3S deployments have `imagePullPolicy: Always`
- This ensures latest image from registry is always pulled
- Requires local registry or external registry to be available

## Key Facts
- All kubectl commands must be run via SSH on the server
- Local registry (localhost:30500) is K3S NodePort
- ClusterIP endpoints are dynamic (look them up live, document if services are recreated)
- Always use `-n flowmaster` namespace for production services

> For live server IPs, namespaces, and ClusterIPs, use commander-mcp: get_context_servers, get_context_services

