karmada/samples/guestbook
yanggang 7a1185f128
Fix wrong reference website for docs.
Signed-off-by: yanggang <gang.yang@daocloud.io>
2023-12-06 10:29:39 +00:00
..
README.md Fix wrong reference website for docs. 2023-12-06 10:29:39 +00:00
guestbook.yaml Add a CRD sample 2022-06-07 20:50:55 +08:00
guestbooks-clusterpropagationpolicy.yaml fix document format and spelling errors for guestbooks example 2022-07-07 14:38:06 +08:00
guestbooks-crd.yaml Add a CRD sample 2022-06-07 20:50:55 +08:00
guestbooks-overridepolicy.yaml Add a CRD sample 2022-06-07 20:50:55 +08:00
guestbooks-propagationpolicy.yaml Add a CRD sample 2022-06-07 20:50:55 +08:00

README.md

Propagate CRD application

The following steps demonstrating how to propagate a Guestbook which is defined by CRD.

Assume you are under the guestbook directory.

cd samples/guestbook

and set the KUBECONFIG environment with Karmada configuration.

export KUBECONFIG=${HOME}/.kube/karmada.config
  1. Create Guestbook CRD in Karmada
kubectl apply -f guestbooks-crd.yaml 

The CRD should be applied to karmada-apiserver.

  1. Create ClusterPropagationPolicy that will propagate Guestbook CRD to member cluster
kubectl apply -f guestbooks-clusterpropagationpolicy.yaml

The CRD will be propagated to member clusters according to the rules defined in ClusterPropagationPolicy

Note: We can only use ClusterPropagationPolicy not PropagationPolicy here. Please refer to FAQ Difference between PropagationPolicy and ClusterPropagationPolicy for more details.

  1. Create a Guestbook named guestbook-sample in Karmada
kubectl apply -f guestbook.yaml
  1. Create PropagationPolicy that will propagate guestbook-sample to member cluster
kubectl apply -f guestbooks-propagationpolicy.yaml
  1. Check the guestbook-sample status from Karmada
kubectl get guestbook -oyaml
  1. Create OverridePolicy that will override the size field of guestbook-sample in member cluster
kubectl apply -f guestbooks-overridepolicy.yaml
  1. Check the size field of guestbook-sample from member cluster
kubectl --kubeconfig=${HOME}/.kube/members.config config use-context member1
kubectl --kubeconfig=${HOME}/.kube/members.config get guestbooks -o yaml

If it works as expected, the .spec.size will be overwritten to 4.