kubesphere / kubekey

Install Kubernetes/K3s only, both Kubernetes/K3s and KubeSphere, and related cloud-native add-ons, it supports all-in-one, multi-node, and HA πŸ”₯ ⎈ 🐳
https://kubesphere.io
Apache License 2.0
2.33k stars 547 forks source link

How can I declare vip of kube-vip? #1893

Open wooarchi opened 1 year ago

wooarchi commented 1 year ago

I used Kubekey provider from ClusterAPI. Also, Kubernetes was deployed based on ClsterClass.

Deployment was successful. However, I think there is a problem in implementing this as GitOps.

The reason is that it is difficult to declare kube-vip address among the values ​​to be declared in Cluster.yaml.

Below are parts of cluster.yml and clusterTemplate.yml.

How can I define kube-vip environment variable address in ClusterTemplate.yml in Cluster.yml?

Do you have any good ideas?

redscholar commented 1 year ago

kube-vip is used for cluster high availability. You can access the entire cluster's API-Server using this address, without worrying about which master node the API-Server is running on. In kubekey, this component is necessary. You just need to configure an available virtual IP address.

wooarchi commented 1 year ago

First of all thanks for your answer.

I want to define kube_vip in cluster.yml not clustertemplate.yml.

I want to define it like in the example below.

What do you think about this?

Any good ideas would be appreciated.

cluster.yml
---
...
    variables:
    - name: user
      value: ubuntu
    - name: password
      value: password
    - name: instances
       value:
       - {address: 10.10.10.11, name: "master1", roles: ["control-plane"]}
       - {address: 10.10.10.31, name: "worker1" , roles: ["worker"]}
       - {address: 10.10.10.32, name: "worker2", roles: ["worker"]}
    - name: controlPlaneLoadBalancer
       value: 10.10.10.100
    - name: kube_vip
       value: ${kube_vip} 
redscholar commented 1 year ago
ζˆͺ屏2023-07-17 17 16 34

The controlPlaneLoadBalancer.value in cluster.yaml is actually equivalent to kube_vip.address in ClusterTemplate.yml. When the environment variable CONTROL_PLANE_ENDPOINT_IP is set and the clusterctl generate cluster command is executed, this variable will automatically populate both values.

redscholar commented 1 year ago

We will consider canceling kube-vip in the future. kube-vip is not a necessary option in the case of domain or single-node setups.