apecloud / kbcli

The CLI for KubeBlocks.
GNU Affero General Public License v3.0
19 stars 14 forks source link

[BUG] kbcli palyground init and destroy error #379

Open JashBook opened 4 months ago

JashBook commented 4 months ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. install kbcli
    curl -fsSL https://kubeblocks.io/installer/install_cli.sh | bash -s v0.9.0-beta.1
  2. kbcli palyground init
    kbcli playground  init --cloud-provider=aws --region=us-west-2 --auto-approve --version 0.9.0-beta.42
  3. See error
    KubeBlocks will be installed to namespace "kb-system"
    Kubernetes version 1.25.16
    Kubernetes provider EKS
    kbcli version 0.9.0-beta.1
    Create CRDs                                        OK
    Add and update repo kubeblocks                     OK
    Install KubeBlocks 0.9.0-beta.42                   OK
    Create cluster mycluster (ClusterDefinition: apecloud-mysql) FAIL
    error: failed to create cluster mycluster: clusterdefinitions.apps.kubeblocks.io "apecloud-mysql" not found

    addon is enable

    
    ➜  ~ kubectl get pod -n kb-system
    NAME                                                     READY   STATUS            RESTARTS   AGE
    install-grafana-addon-97nkj                              1/1     Running           0          78s
    install-prometheus-addon-n4rf9                           1/1     Running           0          78s
    kb-addon-alertmanager-webhook-adaptor-5c9464fc6b-fn6gd   2/2     Running           0          69s
    kb-addon-apecloud-otel-collector-gmn54                   1/1     Running           0          67s
    kb-addon-apecloud-otel-collector-jt8dt                   1/1     Running           0          67s
    kb-addon-apecloud-otel-collector-km5bf                   1/1     Running           0          67s
    kb-addon-apecloud-otel-collector-kmxgh                   1/1     Running           0          67s
    kb-addon-apecloud-otel-collector-lpstz                   1/1     Running           0          67s
    kb-addon-apecloud-otel-collector-nplms                   1/1     Running           0          67s
    kb-addon-aws-load-balancer-controller-759cb9955-zdcjk    1/1     Running           0          62s
    kb-addon-grafana-56dd66cb6c-xg9gb                        0/3     PodInitializing   0          53s
    kb-addon-prometheus-alertmanager-0                       1/2     Running           0          49s
    kb-addon-prometheus-server-0                             1/2     Running           0          49s
    kb-addon-snapshot-controller-76d7f5669b-6ccbf            1/1     Running           0          66s
    kubeblocks-665ff5b8c7-5gxhn                              1/1     Running           0          98s
    kubeblocks-dataprotection-86c67f6746-9nmln               1/1     Running           0          98s

➜ ~ kbcli addon list NAME VERSION PROVIDER STATUS AUTO-INSTALL
csi-driver-nfs 4.5.0 community Disabled false
csi-hostpath-driver 0.7.0 community Disabled false
csi-s3 0.7.0 community Disabled false
external-dns 6.20.4 community Disabled false
fault-chaos-mesh 2.5.2 apecloud Disabled false
kubebench 0.0.1 apecloud Disabled false
kubeblocks-csi-driver 0.1.4 community Disabled false
llm 0.9.0 community Disabled false
loki 5.8.9 community Disabled false
migration 0.1.1 apecloud Disabled false
minio 12.8.12 community Disabled false
nvidia-gpu-exporter 0.3.1 community Disabled false
nyancat 0.7.0 apecloud Disabled false
pyroscope-server 0.2.92 community Disabled false
qdrant 0.9.0 community Disabled false
victoria-metrics-agent 0.8.41 community Disabled false
alertmanager-webhook-adaptor 0.1.4 apecloud Enabled true
apecloud-mysql 0.9.0-beta.10 apecloud Enabled true
apecloud-otel-collector 0.1.2-beta.3 apecloud Enabled true
aws-load-balancer-controller 1.4.8 community Enabled true
kafka 0.9.0 community Enabled true
mongodb 0.9.0 apecloud Enabled true
mysql 0.9.1 community Enabled true
postgresql 0.9.0 community Enabled true
pulsar 0.9.0 community Enabled true
redis 0.9.0 community Enabled true
snapshot-controller 1.7.2 community Enabled true
grafana 6.43.5 community Enabling true
prometheus 15.16.1 community Enabling true

kubectl get cd NAME TOPOLOGIES SERVICEREFS STATUS AGE apecloud-mysql Available 2m11s kafka Available 2m9s mongodb Available 2m10s mongodb-sharding Available 2m10s mysql Available 117s postgresql Available 114s pulsar Available 2m6s pulsar-zookeeper Available 2m6s redis replication,replication-twemproxy,standalone Available 116s

4. See error

➜ ~ kbcli playground destroy --purge=true --auto-approve
Warning: This action will destroy the kubernetes cluster, there may be residual resources, please confirm and manually clean up related resources after this action.

Do you really want to destroy the kubernetes cluster kb-playground-w5qkz? cloud provider: aws cluster name: kb-playground-w5qkz region: us-west-2

The operation cannot be rollbacked. Only 'yes' will be accepted to confirm.

Write kubeconfig to /Users/huangzhangshu/.kbcli/playground/kubeconfig OK Delete clusters created by KubeBlocks OK Uninstall KubeBlocks in namespace "kb-system" Wait for addons to be disabled alertmanager-webhook-adaptor Disabling apecloud-mysql Disabling apecloud-otel-collector Disabling aws-load-balancer-controller Disabling grafana Disabling kafka Disabling mongodb Disabling mysql Disabling postgresql Disabling prometheus Disabling pulsar Disabling redis Disabling snapshot-controller Disabling

Disabling addons: apecloud-mysql, apecloud-otel-collector, mysql, pulsar, snapshot-controller, aws-load-balancer-controller, mongodb, postgresql, alertmanager-webhook-adaptor, prometheus, grafana, kafka, redis Please wait for a while and try to run "kbcli addon list" to check addons status. Failed to uninstall addons, run "kbcli kubeblocks uninstall" to retry. error: context deadline exceeded


**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
 - OS: [e.g. iOS]
 - Browser [e.g. chrome, safari]
 - Version [e.g. 22]

**Additional context**
Repeated execution successful
weicao commented 4 months ago

The error exists in v0.9.0

weicao commented 4 months ago

It appears that the addons are in the process of installation. Before the addon installation is complete, the system may experience various malfunctions and errors.

For instance, if you create a cluster during this time, you might find an event stating that 'csi-hostpath' does not exist. In reality, this occurs because the installation of the 'csi-hostpath' addon has not yet finished.

$ kubectl get events
...
3m46s       Warning   ProvisioningFailed                persistentvolumeclaim/data-weed44-mysql-1        storageclass.storage.k8s.io "csi-hostpath-sc" not found
1s          Normal    ExternalProvisioning              persistentvolumeclaim/data-weed44-mysql-2        waiting for a volume to be created, either by external provisioner "hostpath.csi.k8s.io" or manually created by system administrator
$ kbcli addon list
...
csi-hostpath-driver            0.7.0           community   Enabling   true
...
github-actions[bot] commented 2 months ago

This issue has been marked as stale because it has been open for 30 days with no activity