هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
$ مستخدم عادي# بصلاحية root (أو مع sudo)
Know it before you install
Providers add CRDs for one cloud service (for example AWS S3) and controllers that call the cloud API. A ProviderConfig says which credentials to use. A managed resource (MR) is one cloud resource. Composite resources (XRs) defined by a CompositeResourceDefinition (XRD) and a Composition bundle many MRs behind one simple API for app teams.
| Item | Value |
|---|---|
| Install | Helm chart crossplane-stable/crossplane |
| Namespace | crossplane-system |
| Providers | packages from xpkg.crossplane.io (community) or vendor registries |
| Objects | Provider, ProviderConfig, MRs (Bucket, …), CompositeResourceDefinition, Composition, Function |
| CLI | crossplane (optional: crossplane beta trace, render and validate tools) |
Compared with Terraform: Crossplane reconciles continuously inside the cluster and uses Kubernetes RBAC, GitOps and policies; Terraform runs on demand from a CLI or pipeline. Many teams use both.
Install with Helm
First configuration: an AWS provider with safe credentials
Install one small provider per service you need (not a giant all-in-one). Pin the version you tested (see the provider's releases):
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: provider-aws-s3
spec:
package: xpkg.crossplane.io/crossplane-contrib/provider-aws-s3:v2.1.0kubectl apply -f provider-aws-s3.yaml
kubectl get providers
NAME INSTALLED HEALTHY PACKAGE
provider-aws-s3 True True xpkg.crossplane.io/crossplane-contrib/provider-aws-s3:v2.1.0Credentials: on EKS the best way is IRSA/Pod Identity for the provider's service account (no keys). For a lab, a Secret with keys of a user that may only manage S3:
printf '[default]\naws_access_key_id = %s\naws_secret_access_key = %s\n' "$AWS_ACCESS_KEY_ID" "$AWS_SECRET_ACCESS_KEY" > aws-creds.ini
kubectl -n crossplane-system create secret generic aws-creds --from-file=credentials=aws-creds.ini
rm aws-creds.iniapiVersion: aws.upbound.io/v1beta1
kind: ProviderConfig
metadata:
name: default
spec:
credentials:
source: Secret
secretRef:
namespace: crossplane-system
name: aws-creds
key: credentialsA managed resource
apiVersion: s3.aws.upbound.io/v1beta1
kind: Bucket
metadata:
name: acme-shop-assets-prod
annotations:
crossplane.io/external-name: acme-shop-assets-prod
spec:
forProvider:
region: eu-central-1
tags:
team: shop
managed-by: crossplane
deletionPolicy: Orphan
providerConfigRef:
name: defaultkubectl apply -f bucket.yaml
kubectl get bucket
NAME SYNCED READY EXTERNAL-NAME AGE
acme-shop-assets-prod True True acme-shop-assets-prod 2m
kubectl describe bucket acme-shop-assets-prod| Field | Why |
|---|---|
forProvider | The wanted settings of the cloud resource. |
deletionPolicy: Orphan | Deleting the Kubernetes object does not delete the bucket — safe for important data (default Delete removes it!). |
external-name | The real name in the cloud; also used to import existing resources. |
providerConfigRef | Which credentials/account to use. |
If someone changes the bucket by hand in the console, Crossplane changes it back (drift correction).
Compositions: your own platform API
Instead of giving app teams raw cloud objects, the platform team defines a simple API — for example XPostgresInstance with only size: small|medium and version — with an XRD, and a Composition (a pipeline of functions, for example function-patch-and-transform) that creates the real resources: subnet group, security group, RDS instance, secret with the connection details. App teams then create one small object (in GitOps), and policies (Kyverno) can check it. Start with the official "getting started" composition for your cloud, then adapt it.
Daily use: the commands and the real uses
kubectl get managed
kubectl get providers,providerrevisions
kubectl get composite
kubectl get events --sort-by=.lastTimestamp | tail
crossplane beta trace bucket acme-shop-assets-prod
kubectl -n crossplane-system logs deploy/crossplane --tail 50
kubectl annotate bucket acme-shop-assets-prod crossplane.io/paused=truecrossplane.io/paused=true stops reconciling one resource (for an emergency change); remove the annotation to continue.
Real uses at work:
- A self-service internal platform: teams order databases, buckets and queues as Kubernetes objects.
- GitOps for infrastructure (Argo CD/Flux apply Crossplane objects).
- Continuous drift correction for important cloud resources.
Make it safe
Security checklist:
- Provider credentials: Pod Identity/IRSA or workload identity; if keys, least privilege and rotation.
deletionPolicy: Orphanfor data resources; RBAC on who may delete managed resources.- Only install providers you need, pinned to versions; review their permissions.
- Give app teams composite APIs, not raw MRs — fewer ways to create unsafe resources.
- Policies (Kyverno/OPA) on claims/XRs (sizes, regions, encryption).
- Keep Crossplane and providers updated; watch provider health.
Update and remove
helm repo update
helm upgrade crossplane crossplane-stable/crossplane -n crossplane-system --wait
kubectl patch provider provider-aws-s3 --type merge -p '{"spec":{"package":"xpkg.crossplane.io/crossplane-contrib/provider-aws-s3:v2.2.0"}}'انتبه
Before you uninstall a provider or Crossplane, decide what happens to the cloud resources. Deleting MRs with deletionPolicy: Delete deletes the real resources.
Fix common problems
| Problem | Cause | Fix |
|---|---|---|
Provider HEALTHY False | Image pull failed, or CRD conflicts. | kubectl describe provider; check the package address and version. |
MR SYNCED False: … AccessDenied | The credentials can not do this. | Fix the IAM policy / identity of the ProviderConfig. |
MR READY False for a long time | The cloud is still creating it, or an error. | kubectl describe events; crossplane beta trace. |
cannot get referenced ProviderConfig | Wrong name or not created. | Create ProviderConfig default (or set providerConfigRef). |
| The bucket was deleted with the object | deletionPolicy: Delete (the default). | Use Orphan for data; restore from backup/versioning. |
| Manual cloud change is undone | Crossplane corrects drift (as designed). | Change the Kubernetes object, or pause the resource. |
Next steps
- The CLI way to do IaC: Terraform, OpenTofu, Pulumi.
- Apply it with GitOps: Argo CD, Flux. Guardrails: Kyverno.
- Install charts: Helm.
1What is the difference between Crossplane and running terraform apply?
Crossplane reconciles continuously in the cluster and fixes drift; Terraform changes things only when you run it.
2Why set deletionPolicy: Orphan on a bucket or database?
So deleting the Kubernetes object does not delete the real cloud resource and its data.