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

[Improvement]I modified the service type to LoadBalancer, but it reverts back to its original type #8398

Open
decaMinCow opened this issue Nov 5, 2024 · 5 comments
Assignees
Labels
kind/enhancement New feature or request
Milestone

Comments

@decaMinCow
Copy link

I am encountering an issue where, after changing the Kubernetes service type to LoadBalancer, it keeps reverting to the previous service type. I am unable to persist the change.

@decaMinCow decaMinCow added the kind/enhancement New feature or request label Nov 5, 2024
@shanshanying
Copy link
Contributor

HI @decaMinCow ,
I guess the issue you encountered is: you modified redis'svc, and KB does not reconcile it as what it did to MySQL Cluster. Pleesa add more details.

@decaMinCow
Copy link
Author

When I modify the service type of MySQL to LoadBalancer, the change reverts back. However, for the Redis service, the service type is successfully set to LoadBalancer and persists. I am unsure why this behavior is different between the two services.

Below is the YAML configuration for the Redis cluster where the service type is changing as expected:

apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
  name: redis-cluster
  namespace: test
spec:
  clusterDefinitionRef: redis
  topology: replication
  terminationPolicy: Delete
  affinity:
    podAntiAffinity: Preferred
    topologyKeys:
      - kubernetes.io/hostname
    tenancy: SharedNode
  tolerations:
    - key: kb-data
      operator: Equal
      value: 'true'
      effect: NoSchedule
  componentSpecs:
    - name: redis
      replicas: 3
      disableExporter: true
      enabledLogs:
        - running
      serviceAccountName: kb-redis-cluster
      resources:
        limits:
          cpu: '2'
          memory: 2Gi
        requests:
          cpu: '2'
          memory: 2Gi
      volumeClaimTemplates:
        - name: data
          spec:
            accessModes:
              - ReadWriteOnce
            resources:
              requests:
                storage: 20Gi
    - name: redis-sentinel
      replicas: 3
      resources:
        limits:
          cpu: '2'
          memory: 2Gi
        requests:
          cpu: '2'
          memory: 2Gi
      volumeClaimTemplates:
        - name: data
          spec:
            accessModes:
              - ReadWriteOnce
            resources:
              requests:
                storage: 20Gi

@shanshanying
Copy link
Contributor

And I reproduced this on KB 091.
the apecloud-mysql yaml I used is :

apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
  name: laurel38
  namespace: test
spec:
  clusterDefinitionRef: apecloud-mysql
  clusterVersionRef: ac-mysql-8.0.30
  componentSpecs:
  - componentDefRef: mysql
    disableExporter: true
    name: mysql
    replicas: 1
    resources:
      limits:
        cpu: "0.5"
        memory: 0.5Gi
      requests:
        cpu: "0.5"
        memory: 0.5Gi
    volumeClaimTemplates:
    - name: data
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 20Gi
  terminationPolicy: Delete

@shanshanying
Copy link
Contributor

KubeBlocks: 0.9.2-beta.10
kbcli: 0.9.1

  1. create redis cluster by applying cluster.yaml
  2. kubectl edit redis-cluster-redis-sentinel-redis-sentinel, change svc type from ClusterIP to LoadBalancer
  3. and the change works
  4. expected output: KB should reoncile svc type from LB to ClusterIP.

@shanshanying
Copy link
Contributor

the generated redis svc for sentinal is

apiVersion: v1
kind: Service
metadata:
  creationTimestamp: "2024-11-05T08:04:21Z"
  finalizers:
  - component.kubeblocks.io/finalizer
  labels:
    app.kubernetes.io/instance: redis-cluster
    app.kubernetes.io/managed-by: kubeblocks
    apps.kubeblocks.io/component-name: redis-sentinel
  name: redis-cluster-redis-sentinel-redis-sentinel
  namespace: default
  ownerReferences:
  - apiVersion: apps.kubeblocks.io/v1alpha1
    blockOwnerDeletion: true
    controller: true
    kind: Component
    name: redis-cluster-redis-sentinel
    uid: 20e49f65-0981-44c3-b745-9d28056e4e81
  resourceVersion: "27493"
  uid: 29b87f4d-ab52-47c1-813f-412f8117fd72
spec:
  allocateLoadBalancerNodePorts: true
  clusterIP: 10.96.114.45
  clusterIPs:
  - 10.96.114.45
  externalTrafficPolicy: Cluster
  internalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - name: redis-sentinel
    nodePort: 32035
    port: 26379
    protocol: TCP
    targetPort: redis-sentinel
  selector:
    app.kubernetes.io/instance: redis-cluster
    app.kubernetes.io/managed-by: kubeblocks
    apps.kubeblocks.io/component-name: redis-sentinel
  sessionAffinity: None
  type: LoadBalancer
status:
  loadBalancer: {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants