Solution
Reference solution for Hello Pico on Kubernetes.
Reference solution
A working solution consists of the six files shipped under downloads/, applied in order against a local minikube cluster with Crossplane installed:
01-provider.yaml— installs the Kubernetes Provider and the patch-and-transform function, and pins the provider’s ServiceAccount name via aDeploymentRuntimeConfig.02-rbac.yaml— creates the pinnedprovider-kubernetesServiceAccount, binds it tocluster-admin, and defines aProviderConfigthat authenticates via injected identity.03-xrd.yaml— theXHelloWorldPicoCompositeResourceDefinition (cluster-scoped).04-composition.yaml— aPipeline-mode Composition that produces one cluster-scopedObjectMR which in turn creates a KubernetesJobin thedefaultnamespace.05-xr.yaml— the Composite Resource namedhello, carryingspec.value: "Hello, Pico!".verify.sh— the automatable verification script the walkthrough runs in Step 8.
Commands (recap)
Run from work/hello-pico-on-kubernetes/ after copying the manifests in place (see the walkthrough for the full setup):
kubectl apply -f 01-provider.yaml
kubectl wait --for=condition=Healthy --timeout=120s \
provider.pkg.crossplane.io/provider-kubernetes \
function.pkg.crossplane.io/function-patch-and-transform
kubectl apply -f 02-rbac.yaml
kubectl apply -f 03-xrd.yaml
kubectl wait --for=condition=Established --timeout=60s \
xrd/xhelloworldpicoes.oe.academy
kubectl apply -f 04-composition.yaml
kubectl apply -f 05-xr.yaml
kubectl wait --for=condition=Ready --timeout=120s xhelloworldpico/hello
bash verify.shExpected output
The Job prints the greeting into its container logs:
Hello, Pico!
verify.sh waits for the XR to become Ready and the Job to Complete, then asserts the log line matches:
verify: OK — greeting 'Hello, Pico!' printed by composed Job
Why this satisfies the objectives
- Crossplane installation: Steps 2–3 of the walkthrough install the control plane via helm and confirm the pods are Running.
- Provider + Function: Step 4 installs
provider-kubernetesandfunction-patch-and-transform, both pinned to specific versions fromxpkg.crossplane.io/crossplane-contrib/*. - XRD: Step 6 registers
xhelloworldpicoes.oe.academy, a new higher-level Kubernetes API in theoe.academygroup. - Composition: The same step registers the pipeline-mode Composition that turns any
XHelloWorldPicoXR into a KubernetesJobvia oneObjectManaged Resource. - XR: Step 7 creates the
helloXR carrying the greeting. - Verification: Step 8 runs
verify.sh— a shell command whose exit status is0on success — satisfying §6 of the Runnable Academy Contract.
Verification
You can verify the solution matches this reference by:
- Diffing your copy of each
downloads/*.yamlagainst the versions in the source repository. They should be byte-identical. - Confirming
bash verify.shexits0with theverify: OKline. - Confirming
kubectl get object -o jsonpath='{.items[0].status.conditions[?(@.type=="Synced")].status}'returnsTruefor thehello-*ObjectMR that the Composition produced.
Variations
- Change the greeting: Edit
spec.valuein05-xr.yaml, delete the existingjob/hello-world-pico(Job names are immutable), and reapply the XR. The Composition will render a new Job with the new greeting. - Add a ConfigMap MR: Add a second entry under
pipeline[0].input. resourcesin04-composition.yamlproducing aConfigMapholding the greeting, and patch it fromspec.valuethe same way the Job is patched. This is the natural next step and is the entry point for Part 3 — Extending the composition in the Crossplane course. - Reuse the artifact from the Hello Pico lab: The greeting value in
05-xr.yamlmatches thehello-world-picoartifact produced by the Hello Pico lab. Producing the same greeting from the same declarative input, once on a laptop and once on a cluster, is the point of the mapping the Crossplane lesson teaches.