apache / apisix

The Cloud-Native API Gateway
https://apisix.apache.org/blog/
Apache License 2.0
13.96k stars 2.45k forks source link

bug: apisix-etcd pod CrashLoopBackOff #11189

Open Asakaigg opened 2 months ago

Asakaigg commented 2 months ago

Current Behavior

I am using apache apisix on the kubernetes but when I have installed the apisix but it got the error like this

image image image

Expected Behavior

I need install the apisix on the kubernetes but when I move port forwarding two pods are stopped

Error Logs

No response

Steps to Reproduce

helm install helm install bitnami helm install apisix apisix/apisix --namespace apache-gateway

Environment

apisix version: apisix-3.0.2 Operating system: Ubuntu 22.0.4

hanqingwu commented 2 months ago

Can you check the reason about why etcd apisix-etcd-0 not running ?

Asakaigg commented 2 months ago

this is the guide from apisix due to this error, I have reinstalled with this guide but all pods is not running image https://apisix.apache.org/blog/2021/12/15/deploy-apisix-in-kubernetes/ using kubectl describe pod pod_name --n namespace_name , I got this error image using kubectl logs pod_name --n namespace_name, I got this error image image

Asakaigg commented 2 months ago

Can you check the reason about why etcd apisix-etcd-0 not running ? Could you please check the errors ? It is a little challenge from me. I hope you help me on this

hanqingwu commented 2 months ago

Yes, the etcd cluster is not running normal. So you can scale etcd replicas from 3 to 1 . Or you can try preference etcd cluster config like this:


      ETCD_ENABLE_V2:                    true
      ALLOW_NONE_AUTHENTICATION:         yes
      ETCD_NAME:                         cooper-apisix-etcd-1 (v1:metadata.name)
      POD_IP:                             (v1:status.podIP)
      ETCD_ADVERTISE_CLIENT_URLS:        http://$(POD_IP):2379
      ETCD_INITIAL_ADVERTISE_PEER_URLS:  http://$(ETCD_NAME).cooper-apisix-etcd.paas-middleware-workspace-middleware.svc:2380
      ETCD_LISTEN_CLIENT_URLS:           http://0.0.0.0:2379
      ETCD_LISTEN_PEER_URLS:             http://0.0.0.0:2380
      ETCD_INITIAL_CLUSTER:              cooper-apisix-etcd-0=http://cooper-apisix-etcd-0.cooper-apisix-etcd.paas-middleware-workspace-middleware.svc:2380,cooper-apisix-etcd-1=http://cooper-apisix-etcd-1.cooper-apisix-etcd.paas-middleware-workspace-middleware.svc:2380,cooper-apisix-etcd-2=http://cooper-apisix-etcd-2.cooper-apisix-etcd.paas-middleware-workspace-middleware.svc:2380
      ETCD_INITIAL_CLUSTER_TOKEN:        apisix-etcd-cluster
      ETCD_INITIAL_CLUSTER_STATE:        new
      ETCD_DEBUG:                        true
Asakaigg commented 2 months ago

ETCD_ADVERTISE_CLIENT_URLS

Yes, the etcd cluster is not running normal. So you can scale etcd replicas from 3 to 1 . Or you can try preference etcd cluster config like this:


      ETCD_ENABLE_V2:                    true
      ALLOW_NONE_AUTHENTICATION:         yes
      ETCD_NAME:                         cooper-apisix-etcd-1 (v1:metadata.name)
      POD_IP:                             (v1:status.podIP)
      ETCD_ADVERTISE_CLIENT_URLS:        http://$(POD_IP):2379
      ETCD_INITIAL_ADVERTISE_PEER_URLS:  http://$(ETCD_NAME).cooper-apisix-etcd.paas-middleware-workspace-middleware.svc:2380
      ETCD_LISTEN_CLIENT_URLS:           http://0.0.0.0:2379
      ETCD_LISTEN_PEER_URLS:             http://0.0.0.0:2380
      ETCD_INITIAL_CLUSTER:              cooper-apisix-etcd-0=http://cooper-apisix-etcd-0.cooper-apisix-etcd.paas-middleware-workspace-middleware.svc:2380,cooper-apisix-etcd-1=http://cooper-apisix-etcd-1.cooper-apisix-etcd.paas-middleware-workspace-middleware.svc:2380,cooper-apisix-etcd-2=http://cooper-apisix-etcd-2.cooper-apisix-etcd.paas-middleware-workspace-middleware.svc:2380
      ETCD_INITIAL_CLUSTER_TOKEN:        apisix-etcd-cluster
      ETCD_INITIAL_CLUSTER_STATE:        new
      ETCD_DEBUG:                        true

Could you explain the difference between standard and your configuration ?

git clone https://github.com/zaunist/apisix-on-kubernetes.git I have download the etcd.yaml and changed

Asakaigg commented 2 months ago

this is my pod yaml using kubectl edit command for the pod but it seems different with your config