Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] workloadspread 调度的不对 #1227

Closed
13567436138 opened this issue Mar 19, 2023 · 2 comments
Closed

[BUG] workloadspread 调度的不对 #1227

13567436138 opened this issue Mar 19, 2023 · 2 comments
Assignees
Labels
kind/bug Something isn't working

Comments

@13567436138
Copy link

What happened:
cloneset-nginx.yaml

kubectl apply -f cloneset-nginx.yaml -n kruise

apiVersion: apps.kruise.io/v1alpha1
kind: CloneSet
metadata:
  labels:
    app: nginx
  name: nginx
spec:
  replicas: 5
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:alpine

wls/wls-subsets-preferredNodeSelectorTerms-preference-matchFields.yaml

apiVersion: apps.kruise.io/v1alpha1
kind: WorkloadSpread
metadata:
  name: wls
spec:
  targetRef:
    apiVersion: apps.kruise.io/v1alpha1
    kind: CloneSet
    name: nginx
  subsets:
  - name: subset-a 
    maxReplicas: 2
    requiredNodeSelectorTerm:
      matchExpressions:
      - key: topology.kubernetes.io/zone
        operator: In
        values:
        - z3
    preferredNodeSelectorTerms:
    - preference:
        matchFields:
        - key: metadata.name
          operator: In
          values: 
          - 192.168.229.128
      weight: 100
  - name: subset-b
    requiredNodeSelectorTerm:
      matchExpressions:
      - key: topology.kubernetes.io/zone
        operator: In
        values:
        - z2
kubectl label node 192.168.229.128 topology.kubernetes.io/zone=z3 --overwrite
kubectl label node 192.168.229.129 topology.kubernetes.io/zone=z3 --overwrite
kubectl label node 192.168.229.130 topology.kubernetes.io/zone=z2 --overwrite
kubectl label node 192.168.229.128 topology.istio.io/subzone=sz01 --overwrite
kubectl label node 192.168.229.129 topology.istio.io/subzone=sz02 --overwrite
kubectl label node 192.168.229.130 topology.istio.io/subzone=sz03 --overwrite

kubectl apply -f wls-subsets-preferredNodeSelectorTerms-preference-matchFields.yaml -n kruise
 
kubectl kruise rollout restart cloneset nginx -n kruise

C[root@node01 wls]# kubectl get pod -n kruise -owide  -w
NAME                                      READY   STATUS    RESTARTS   AGE     IP             NODE              NOMINATED NODE   READINESS GATES
nfs-client-provisioner-69557bfdb8-hzplg   0/1     Unknown   0          99d     <none>         192.168.229.128   <none>           <none>
nginx-48h42                               1/1     Running   0          3m42s   172.20.2.27    192.168.229.130   <none>           2/2
nginx-8hkmx                               1/1     Running   0          2m54s   172.20.2.29    192.168.229.130   <none>           2/2
nginx-9wn2q                               1/1     Running   0          3m43s   172.20.2.26    192.168.229.130   <none>           2/2
nginx-xskqc                               1/1     Running   0          3m10s   172.20.0.131   192.168.229.128   <none>           2/2
nginx-zqs5f                               1/1     Running   0          3m26s   172.20.2.28    192.168.229.130   <none>           2/2

128,129只有一个,不是max为2个么

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Environment:

  • Kruise version:
  • Kubernetes version (use kubectl version):
  • Install details (e.g. helm install args):
  • Others:
@13567436138 13567436138 added the kind/bug Something isn't working label Mar 19, 2023
@veophi
Copy link
Member

veophi commented Mar 19, 2023

@13567436138 Please ensure that you have enabled the WorkloadSpread feature-gate when installing kruise.

@veophi
Copy link
Member

veophi commented Mar 19, 2023

Maybe, your problem is similar with #1194.

This problem will be fixed after #1197 is merged.

@zmberg zmberg assigned veophi and unassigned FillZpp Mar 23, 2023
@zmberg zmberg closed this as completed Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants