kubekey
kubekey copied to clipboard
fix: support scaling up/down etcd
What type of PR is this?
/kind feature
What this PR does / why we need it:
Should support etcd scaling:
- scaling up etcd:
- Define the etcd nodes in inventory.yaml.
apiVersion: kubekey.kubesphere.io/v1
kind: Inventory
metadata:
name: default
spec:
hosts: # your can set all nodes here. or set nodes on special groups.
node1:
connector:
host: 172.16.66.7
internal_ipv4: 172.16.66.7
node2:
connector:
host: 172.16.66.3
internal_ipv4: 172.16.66.3
node3:
connector:
host: 172.16.66.4
internal_ipv4: 172.16.66.4
groups:
# all kubernetes nodes.
k8s_cluster:
groups:
- kube_control_plane
- kube_worker
# control_plane nodes
kube_control_plane:
hosts:
- node1
# worker nodes
kube_worker:
hosts:
- node1
# etcd nodes when etcd_deployment_type is external
etcd:
hosts:
- node1
- Create cluster by this inventory.yaml
kk create cluster -i inventory.yaml - Add etcd node in inventory.yaml
apiVersion: kubekey.kubesphere.io/v1
kind: Inventory
metadata:
name: default
spec:
hosts: # your can set all nodes here. or set nodes on special groups.
node1:
connector:
host: 172.16.66.7
internal_ipv4: 172.16.66.7
node2:
connector:
host: 172.16.66.3
internal_ipv4: 172.16.66.3
node3:
connector:
host: 172.16.66.4
internal_ipv4: 172.16.66.4
groups:
# all kubernetes nodes.
k8s_cluster:
groups:
- kube_control_plane
- kube_worker
# control_plane nodes
kube_control_plane:
hosts:
- node1
- node2
- node3
# worker nodes
kube_worker:
hosts:
- node1
- node2
- node3
# etcd nodes when etcd_deployment_type is external
etcd:
hosts:
- node1
- node2
- node3
- Scaling up etcd.
kk add nodes -i inventory.yaml
- scaling down etcd:
- Define the etcd nodes in inventory.yaml.
apiVersion: kubekey.kubesphere.io/v1
kind: Inventory
metadata:
name: default
spec:
hosts: # your can set all nodes here. or set nodes on special groups.
node1:
connector:
host: 172.16.66.7
internal_ipv4: 172.16.66.7
node2:
connector:
host: 172.16.66.3
internal_ipv4: 172.16.66.3
node3:
connector:
host: 172.16.66.4
internal_ipv4: 172.16.66.4
groups:
# all kubernetes nodes.
k8s_cluster:
groups:
- kube_control_plane
- kube_worker
# control_plane nodes
kube_control_plane:
hosts:
- node1
- node2
- node3
# worker nodes
kube_worker:
hosts:
- node1
- node2
- node3
# etcd nodes when etcd_deployment_type is external
etcd:
hosts:
- node1
- node2
- node3
- Create cluster by this inventory.yaml
kk create cluster -i inventory.yaml - Scaling down etcd
kk delete nodes -i inventory.yaml node2 node3
test results
Which issue(s) this PR fixes:
Fixes # https://github.com/kubesphere/kubekey/issues/2728 https://github.com/kubesphere/kubekey/issues/2742
Special notes for reviewers:
Does this PR introduced a user-facing change?
fix: support scaling down etcd
Additional documentation, usage docs, etc.:
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: redscholar
The full list of commands accepted by this bot can be found here.
The pull request process is described here
Needs approval from an approver in each of these files:
- ~~OWNERS~~ [redscholar]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
