Hi,
I am trying to deploy an API Gateway. I followed this tutorial Enable external traffic ingress into Consul service mesh | Consul | HashiCorp Developer however I am getting a connection refused
error when connecting to the API Gateway. Here is my config:
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: api-gateway
namespace: default
spec:
gatewayClassName: consul
listeners:
# options: HTTP or HTTPS
- protocol: HTTP
# options: 80 or 443 or custom
port: 8083
name: http
allowedRoutes:
namespaces:
# options: All or Same or Specific
from: All
---
apiVersion: consul.hashicorp.com/v1alpha1
kind: ServiceIntentions
metadata:
name: api-gateway-ingress
spec:
destination:
name: smf-http2
sources:
- name: api-gateway
action: allow
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: gateway-smf-route
namespace: default
spec:
parentRefs:
- name: api-gateway
namespace: default
rules:
- matches:
- path:
type: Exact
value: /jsonrpc
backendRefs:
- kind: Service
name: smf-http2
port: 8083
consul helm values:
connectInject:
enabled: true
apiGateway:
# Configuration settings for the GatewayClass
managedGatewayClass:
# Defines the type of service created for gateways (e.g. LoadBalancer, ClusterIP, NodePort)
# LoadBalancer is primarily used for cloud deployments.
serviceType: NodePort
# Toggles the gateway ports to be mapped to host ports (used for local deployments)
useHostPorts: false
global:
acls:
manageSystemACLs: true
datacenter: dc1
enabled: true
name: consul
tls:
enableAutoEncrypt: true
enabled: true
httpsOnly: false
verify: false
gossipEncryption:
autoGenerate: true
server:
replicas: 1
securityContext:
fsGroup: 0
runAsGroup: 0
runAsNonRoot: false
runAsUser: 0
updatePartition: 0
ui:
enabled: true
service:
type: NodePort
api gateway pod is up and running:
$ kubectl get pods | grep "api-gateway"
NAME READY STATUS RESTARTS AGE
api-gateway-b9fd6dc6f-rvgdz 1/1 Running 0 11m
When I call it using curl from another service that is outside of a service mesh I am getting a connection refused
error:
* Hostname api-gateway.default.svc.cluster.local was found in DNS cache
* Trying 10.109.81.63:8083...
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* connect to 10.109.81.63 port 8083 failed: Connection refused
* Failed to connect to api-gateway.default.svc.cluster.local port 8083 after 0 ms: Connection refused
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
* Closing connection 30
curl: (7) Failed to connect to api-gateway.default.svc.cluster.local port 8083 after 0 ms: Connection refused
I am using a minikube deployment. Services registered in service mesh have multiple ports (I configured them as shown in How does Consul Service Mesh Work on Kubernetes? | Consul | HashiCorp Developer).
Did anyone have similar issue?