Karmada Multi-Cluster Kubernetes: Scheduling

๐Ÿ’ก Karmada Multi-Cluster Kubernetes: Scheduling โ€” Executive Summary

Technical architectural analysis, practical configuration manifests, and deployment instructions for Karmada Multi-Cluster Kubernetes: Scheduling.

Related pages
Operation
karmada-apiserver

This is a control-plane running as a pod, and the deploy of the apiserver does not deploy the pod, but deploys the member cluster.

txt
kubectl config use-context karmada-apiserver
kubectl get deploy,pp,cpp -A
Query member cluster resources
txt
## ์„ค์น˜๋ฐฉ์‹์— ๋”ฐ๋ผ์„œ kubectl karmada, kubectl-karmada, karmadactl ๋“ฑ์œผ๋กœ ์‚ฌ์šฉ๋จ.
## ์•„๋ž˜์—์„œ๋Š” kubectl karmada๋กœ ์˜ˆ์‹œ
## kubectl ๋ช…๋ น์–ด์™€ ๋™์ผํ•˜๋ฉฐ, CLUSTER column์ด ์ถ”๊ฐ€๋จ
kubectl karmada get pods
kubectl karmada get deploy
kubectl karmada get svc -A ...
View member cluster log
txt
## ๋ฐ˜๋“œ์‹œ ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ์ง€์ •ํ•ด์•ผ ํ•จ
kubectl karmada get deploy nfs-pod-provisioner
>>>
NAME                  CLUSTER    READY   UP-TO-DATE   AVAILABLE   AGE     ADOPTION
nfs-pod-provisioner   cluster1   1/1     1            1           6d17h   N
nfs-pod-provisioner   cluster2   1/1     1            1           7d      N
<<<

kubectl karmada logs deploy/nfs-pod-provisioner --cluster=cluster1 -f
Resource propagation policy settings and deployment propagation (example: deployment/nginx)

Resource Propagating | karmada

The deploy of a member cluster deployed in this way is recreated by karmada-scheduler even if it is deleted directly from the member

txt
#karmada apiserver ์‚ฌ์šฉ
kubectl config use-context karmada-apiserver

kubectl get clusters
kubectl apply -f propagationpolicy.yaml#์•„๋ž˜์˜ ์˜ˆ์‹œ ์ฐธ์กฐ#kubectl get cpp #clusterpropagationpolicies.policy.karmada.io
kubectl get pp#propagationpolicies.policy.karmada.io
kubectl create ns karmada-test
kubectl create deploy nginx -n karmada-test --image=nginx --replicas=2

#karmada control-plane์—์„œ ๋ฐฐํฌ ํ™•์ธ
kubectl get deploy -n karmada-test
>>>
NAME    READY   UP-TO-DATE   AVAILABLE   AGE
nginx   2/2     2            2           16s
<<<

#๋ฉค๋ฒ„ํด๋Ÿฌ์Šคํ„ฐ ๋ฐฐํฌ ํ™•์ธ
kubectl karmada get deploy -n karmada-test
>>>
NAME    CLUSTER    READY   UP-TO-DATE   AVAILABLE   AGE   ADOPTION
nginx   cluster1   1/1     1            1           29s   Y
nginx   cluster2   1/1     1            1           29s   Y
<<<
samples
propagationpolicy.yaml

https://github.com/karmada-io/karmada/blob/master/samples/nginx/propagationpolicy.yaml

txt
apiVersion: policy.karmada.io/v1alpha1
kind: PropagationPolicy
metadata:
  name: nginx-propagation
  namespace: karmada-test
spec:
  resourceSelectors:
    - apiVersion: apps/v1
      kind: Deployment
      name: nginx
      namespace: karmada-test
  placement:
    clusterAffinity:
      clusterNames:
        - cluster1
        - cluster2
    replicaScheduling:
      replicaDivisionPreference: Weighted
      replicaSchedulingType: Divided
      weightPreference:
        staticWeightList:
          - targetCluster:
              clusterNames:
                - cluster1
            weight: 1
          - targetCluster:
              clusterNames:
                - cluster2
            weight: 1
cpp.yaml
txt
apiVersion: policy.karmada.io/v1alpha1
kind: ClusterPropagationPolicy
metadata:
  name: nginx-clusterpropagation
spec:
  resourceSelectors:
    - apiVersion: apps/v1
      kind: Deployment
      name: nginx
      namespace: karmada-test2
  placement:
    clusterAffinity:
      clusterNames:
        - cluster1
        - cluster2
    replicaScheduling:
      replicaDivisionPreference: Weighted
      replicaSchedulingType: Divided
      weightPreference:
        staticWeightList:
          - targetCluster:
              clusterNames:
                - cluster1
            weight: 1
          - targetCluster:
              clusterNames:
                - cluster2
            weight: 1

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *