Skip to content

Latest commit

 

History

History
 
 

guestbook

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.