Crossplane Deep-Dive Skill
Advanced analysis of Crossplane compositions, provider internals, and infrastructure reconciliation.
MANDATORY: Discovery-First Pattern
Always check provider health and installed XRDs before deep-diving into resources.
Phase 1: Discovery
#!/bin/bash
echo "=== Crossplane Core ==="
kubectl get deployment crossplane -n crossplane-system -o custom-columns='NAME:.metadata.name,READY:.status.readyReplicas,IMAGE:.spec.template.spec.containers[0].image' 2>/dev/null
echo ""
echo "=== RBAC Manager ==="
kubectl get deployment crossplane-rbac-manager -n crossplane-system -o custom-columns='NAME:.metadata.name,READY:.status.readyReplicas' 2>/dev/null
echo ""
echo "=== Provider Health ==="
kubectl get providers.pkg.crossplane.io -o custom-columns='NAME:.metadata.name,INSTALLED:.status.conditions[?(@.type=="Installed")].status,HEALTHY:.status.conditions[?(@.type=="Healthy")].status,PACKAGE:.spec.package,REVISION:.status.currentRevision' 2>/dev/null
echo ""
echo "=== Functions ==="
kubectl get functions.pkg.crossplane.io -o custom-columns='NAME:.metadata.name,INSTALLED:.status.conditions[?(@.type=="Installed")].status,HEALTHY:.status.conditions[?(@.type=="Healthy")].status,PACKAGE:.spec.package' 2>/dev/null
echo ""
echo "=== XRDs ==="
kubectl get xrd -o custom-columns='NAME:.metadata.name,ESTABLISHED:.status.conditions[?(@.type=="Established")].status,OFFERED:.status.conditions[?(@.type=="Offered")].status,GROUP:.spec.group' 2>/dev/null
echo ""
echo "=== Compositions ==="
kubectl get compositions -o custom-columns='NAME:.metadata.name,XR-KIND:.spec.compositeTypeRef.kind,RESOURCES:.spec.resources' 2>/dev/null | head -15
Phase 2: Analysis
#!/bin/bash
echo "=== Managed Resources Not Ready ==="
kubectl get managed -o json 2>/dev/null | jq -r '
.items[] |
select(.status.conditions[]? | select(.type == "Ready" and .status != "True")) |
"\(.kind)/\(.metadata.name)\tReady:\(.status.conditions[] | select(.type == "Ready") | "\(.status) \(.reason)")\tSynced:\(.status.conditions[] | select(.type == "Synced") | .status)"
' | head -20
echo ""
echo "=== Stale Resources (Synced=False) ==="
kubectl get managed -o json 2>/dev/null | jq -r '
.items[] |
select(.status.conditions[]? | select(.type == "Synced" and .status != "True")) |
"\(.kind)/\(.metadata.name)\t\(.status.conditions[] | select(.type == "Synced") | .reason): \(.message // "no message")[0:80]"
' | head -15
echo ""
echo "=== Composite Resources ==="
for xrd in $(kubectl get xrd -o jsonpath='{.items[*].metadata.name}' 2>/dev/null); do
KIND=$(kubectl get xrd "$xrd" -o jsonpath='{.spec.names.kind}' 2>/dev/null)
kubectl get "$KIND" -o custom-columns="KIND:.kind,NAME:.metadata.name,READY:.status.conditions[?(@.type==\"Ready\")].status,COMPOSITION:.spec.compositionRef.name" 2>/dev/null | tail -n +2
done | head -15
echo ""
echo "=== Claims (all namespaces) ==="
kubectl get claim --all-namespaces -o custom-columns='NAMESPACE:.metadata.namespace,KIND:.kind,NAME:.metadata.name,READY:.status.conditions[?(@.type=="Ready")].status' 2>/dev/null | head -15
echo ""
echo "=== Provider Config Health ==="
for provider in $(kubectl get providers.pkg.crossplane.io -o jsonpath='{.items[*].metadata.name}' 2>/dev/null); do
kubectl get providerconfigs -l pkg.crossplane.io/package="$provider" 2>/dev/null | head -5
done
echo ""
echo "=== EnvironmentConfigs ==="
kubectl get environmentconfigs -o custom-columns='NAME:.metadata.name,AGE:.metadata.creationTimestamp' 2>/dev/null
echo ""
echo "=== Usages (dependency tracking) ==="
kubectl get usages -o custom-columns='NAME:.metadata.name,OF:.spec.of.kind,BY:.spec.by.kind' 2>/dev/null | head -10
echo ""
echo "=== Provider Pod Errors ==="
for pod in $(kubectl get pods -n crossplane-system -l pkg.crossplane.io/revision -o name 2>/dev/null); do
echo "--- $pod ---"
kubectl logs "$pod" -n crossplane-system --tail=5 2>/dev/null | grep -i "error\|cannot\|fail" | head -3
done
Output Format
- Target ≤50 lines per output
- Use
-o custom-columns and jq for CRD field extraction
- Show Ready/Synced conditions prominently for all resources
- Group managed resources by provider/kind when many exist
- Never dump full composition YAML -- show compositeTypeRef and resource count
Anti-Hallucination Rules
- NEVER assume resource names — always discover via CLI/API in Phase 1 before referencing in Phase 2.
- NEVER fabricate metric names or dimensions — verify against the service documentation or
--help output.
- NEVER mix CLI commands between service versions — confirm which version/API you are targeting.
- ALWAYS use the discovery → verify → analyze chain — every resource referenced must have been discovered first.
- ALWAYS handle empty results gracefully — an empty response is valid data, not an error to retry.
Counter-Rationalizations
| Shortcut |
Counter |
Why |
| "I'll skip discovery and check known resources" |
Always run Phase 1 discovery first |
Resource names change, new resources appear — assumed names cause errors |
| "The user only asked for a quick check" |
Follow the full discovery → analysis flow |
Quick checks miss critical issues; structured analysis catches silent failures |
| "Default configuration is probably fine" |
Audit configuration explicitly |
Defaults often leave logging, security, and optimization features disabled |
| "Metrics aren't needed for this" |
Always check relevant metrics when available |
API/CLI responses show current state; metrics reveal trends and intermittent issues |
| "I don't have access to that" |
Try the command and report the actual error |
Assumed permission failures prevent useful investigation; actual errors are informative |
Common Pitfalls
- Provider vs ProviderConfig: Provider is the package; ProviderConfig holds credentials -- both must be healthy
- Composition selection: Multiple compositions can match an XR -- use
compositionSelector or compositionRef for determinism
- Patch types: FromCompositeFieldPath, ToCompositeFieldPath, CombineFromComposite -- wrong patch type causes silent failures
- Finalizer blocking: Deleting XRs deletes all composed resources -- stuck finalizers indicate provider issues
- Management policies: ObserveOnly, OrphanOnDelete -- understand lifecycle implications before changing
- Functions pipeline: Crossplane Functions (v1.14+) replace patch-and-transform -- check if compositions use pipeline mode
- DeploymentRuntimeConfig: Controls provider pod resources, replicas, and node selectors
- Dependency ordering: Use
readinessChecks and Usages to handle resource dependencies
1---2name: managing-k8s-crossplane-deep3description: |4 Use when working with K8S Crossplane Deep — crossplane deep-dive management5 for Kubernetes-native infrastructure provisioning. Covers provider health6 diagnostics, composition debugging, XRD schema validation, claim lifecycle7 analysis, managed resource drift detection, usage tracking, and8 EnvironmentConfig management. Use when debugging complex composition failures,9 analyzing cross-provider resource dependencies, or optimizing Crossplane10 performance.11connection_type: k8s12preload: false13metadata:14 source: https://skillmd.com/skills/cloudthinker-ai/managing-k8s-crossplane-deep15---1617# Crossplane Deep-Dive Skill1819Advanced analysis of Crossplane compositions, provider internals, and infrastructure reconciliation.2021## MANDATORY: Discovery-First Pattern2223**Always check provider health and installed XRDs before deep-diving into resources.**2425### Phase 1: Discovery2627```bash28#!/bin/bash2930echo "=== Crossplane Core ==="31kubectl get deployment crossplane -n crossplane-system -o custom-columns='NAME:.metadata.name,READY:.status.readyReplicas,IMAGE:.spec.template.spec.containers[0].image' 2>/dev/null3233echo ""34echo "=== RBAC Manager ==="35kubectl get deployment crossplane-rbac-manager -n crossplane-system -o custom-columns='NAME:.metadata.name,READY:.status.readyReplicas' 2>/dev/null3637echo ""38echo "=== Provider Health ==="39kubectl get providers.pkg.crossplane.io -o custom-columns='NAME:.metadata.name,INSTALLED:.status.conditions[?(@.type=="Installed")].status,HEALTHY:.status.conditions[?(@.type=="Healthy")].status,PACKAGE:.spec.package,REVISION:.status.currentRevision' 2>/dev/null4041echo ""42echo "=== Functions ==="43kubectl get functions.pkg.crossplane.io -o custom-columns='NAME:.metadata.name,INSTALLED:.status.conditions[?(@.type=="Installed")].status,HEALTHY:.status.conditions[?(@.type=="Healthy")].status,PACKAGE:.spec.package' 2>/dev/null4445echo ""46echo "=== XRDs ==="47kubectl get xrd -o custom-columns='NAME:.metadata.name,ESTABLISHED:.status.conditions[?(@.type=="Established")].status,OFFERED:.status.conditions[?(@.type=="Offered")].status,GROUP:.spec.group' 2>/dev/null4849echo ""50echo "=== Compositions ==="51kubectl get compositions -o custom-columns='NAME:.metadata.name,XR-KIND:.spec.compositeTypeRef.kind,RESOURCES:.spec.resources' 2>/dev/null | head -1552```5354### Phase 2: Analysis5556```bash57#!/bin/bash5859echo "=== Managed Resources Not Ready ==="60kubectl get managed -o json 2>/dev/null | jq -r '61 .items[] |62 select(.status.conditions[]? | select(.type == "Ready" and .status != "True")) |63 "\(.kind)/\(.metadata.name)\tReady:\(.status.conditions[] | select(.type == "Ready") | "\(.status) \(.reason)")\tSynced:\(.status.conditions[] | select(.type == "Synced") | .status)"64' | head -206566echo ""67echo "=== Stale Resources (Synced=False) ==="68kubectl get managed -o json 2>/dev/null | jq -r '69 .items[] |70 select(.status.conditions[]? | select(.type == "Synced" and .status != "True")) |71 "\(.kind)/\(.metadata.name)\t\(.status.conditions[] | select(.type == "Synced") | .reason): \(.message // "no message")[0:80]"72' | head -157374echo ""75echo "=== Composite Resources ==="76for xrd in $(kubectl get xrd -o jsonpath='{.items[*].metadata.name}' 2>/dev/null); do77 KIND=$(kubectl get xrd "$xrd" -o jsonpath='{.spec.names.kind}' 2>/dev/null)78 kubectl get "$KIND" -o custom-columns="KIND:.kind,NAME:.metadata.name,READY:.status.conditions[?(@.type==\"Ready\")].status,COMPOSITION:.spec.compositionRef.name" 2>/dev/null | tail -n +279done | head -158081echo ""82echo "=== Claims (all namespaces) ==="83kubectl get claim --all-namespaces -o custom-columns='NAMESPACE:.metadata.namespace,KIND:.kind,NAME:.metadata.name,READY:.status.conditions[?(@.type=="Ready")].status' 2>/dev/null | head -158485echo ""86echo "=== Provider Config Health ==="87for provider in $(kubectl get providers.pkg.crossplane.io -o jsonpath='{.items[*].metadata.name}' 2>/dev/null); do88 kubectl get providerconfigs -l pkg.crossplane.io/package="$provider" 2>/dev/null | head -589done9091echo ""92echo "=== EnvironmentConfigs ==="93kubectl get environmentconfigs -o custom-columns='NAME:.metadata.name,AGE:.metadata.creationTimestamp' 2>/dev/null9495echo ""96echo "=== Usages (dependency tracking) ==="97kubectl get usages -o custom-columns='NAME:.metadata.name,OF:.spec.of.kind,BY:.spec.by.kind' 2>/dev/null | head -109899echo ""100echo "=== Provider Pod Errors ==="101for pod in $(kubectl get pods -n crossplane-system -l pkg.crossplane.io/revision -o name 2>/dev/null); do102 echo "--- $pod ---"103 kubectl logs "$pod" -n crossplane-system --tail=5 2>/dev/null | grep -i "error\|cannot\|fail" | head -3104done105```106107## Output Format108109- Target ≤50 lines per output110- Use `-o custom-columns` and jq for CRD field extraction111- Show Ready/Synced conditions prominently for all resources112- Group managed resources by provider/kind when many exist113- Never dump full composition YAML -- show compositeTypeRef and resource count114115## Anti-Hallucination Rules1161171. **NEVER assume resource names** — always discover via CLI/API in Phase 1 before referencing in Phase 2.1182. **NEVER fabricate metric names or dimensions** — verify against the service documentation or `--help` output.1193. **NEVER mix CLI commands between service versions** — confirm which version/API you are targeting.1204. **ALWAYS use the discovery → verify → analyze chain** — every resource referenced must have been discovered first.1215. **ALWAYS handle empty results gracefully** — an empty response is valid data, not an error to retry.122123## Counter-Rationalizations124125| Shortcut | Counter | Why |126|----------|---------|-----|127| "I'll skip discovery and check known resources" | Always run Phase 1 discovery first | Resource names change, new resources appear — assumed names cause errors |128| "The user only asked for a quick check" | Follow the full discovery → analysis flow | Quick checks miss critical issues; structured analysis catches silent failures |129| "Default configuration is probably fine" | Audit configuration explicitly | Defaults often leave logging, security, and optimization features disabled |130| "Metrics aren't needed for this" | Always check relevant metrics when available | API/CLI responses show current state; metrics reveal trends and intermittent issues |131| "I don't have access to that" | Try the command and report the actual error | Assumed permission failures prevent useful investigation; actual errors are informative |132133## Common Pitfalls134135- **Provider vs ProviderConfig**: Provider is the package; ProviderConfig holds credentials -- both must be healthy136- **Composition selection**: Multiple compositions can match an XR -- use `compositionSelector` or `compositionRef` for determinism137- **Patch types**: FromCompositeFieldPath, ToCompositeFieldPath, CombineFromComposite -- wrong patch type causes silent failures138- **Finalizer blocking**: Deleting XRs deletes all composed resources -- stuck finalizers indicate provider issues139- **Management policies**: ObserveOnly, OrphanOnDelete -- understand lifecycle implications before changing140- **Functions pipeline**: Crossplane Functions (v1.14+) replace patch-and-transform -- check if compositions use pipeline mode141- **DeploymentRuntimeConfig**: Controls provider pod resources, replicas, and node selectors142- **Dependency ordering**: Use `readinessChecks` and Usages to handle resource dependencies