Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way that EDS IPAddress accepts docker hostname with EDS Cluster? #87

Closed
oneamitj opened this issue Jun 27, 2018 · 14 comments
Closed

Comments

@oneamitj
Copy link

oneamitj commented Jun 27, 2018

Is there a way we can use docker service eg webapp_dev_webapp.1.no9rqsfuz73k026uod3hsjk83 as core.SocketAddress.Address?

Docker service name for a static cluster address defined in envoy config yaml works well and resolves fine, as cluster type is logical_dns. For dynamic Envoy config, cluster type = EDS, and each cluster has its Endpoints. If I provide normal IP Address and port for each Endpoint, it works fine.
But each of my services is hosted in docker, and there is an issue using docker's internal ipaddress which is in subnet format. My option is to use docker services' Host name, as envoy itself is in same docker network, resolving hostname should not be a problem.

I initialized Endpoint as

endpoints := make([]cache.Resource, 1)
var eps []endpoint.LbEndpoint
eps = append(eps, endpoint.LbEndpoint{Endpoint: &endpoint.Endpoint{
	Address: &core.Address{
		Address: &core.Address_SocketAddress{
			SocketAddress: &core.SocketAddress{
				Protocol: core.TCP,
				Address: "webapp_dev_webapp.1.no9rqsfuz73k026uod3hsjk83",
				ResolverName: "LOGICAL_DNS",
				PortSpecifier: &core.SocketAddress_PortValue{
					PortValue: uint32(8080),
				},
			},
		},
	},
},
})

endpoints[0] = &v2.ClusterLoadAssignment{
	ClusterName: "my_cluster",
	Endpoints: []endpoint.LocalityLbEndpoints{{
		LbEndpoints: eps,
	}},
}

var edsSource *core.ConfigSource
edsSource = &core.ConfigSource{
	ConfigSourceSpecifier: &core.ConfigSource_Ads{
		Ads: &core.AggregatedConfigSource{},
	},
}
cluster := &v2.Cluster{
	Name:          "my_cluster",
	ConnectTimeout: 5 * time.Second,
	Type:           v2.Cluster_EDS,
	EdsClusterConfig: &v2.Cluster_EdsClusterConfig{
		EdsConfig: edsSource,
	},
}

// some listener and routes too

After generating and setting snapshot with above settings, envoys updates LDS, RDS, CDS but throws error in EDS as
[warning][config] bazel-out/k8-opt/bin/source/common/config/_virtual_includes/grpc_mux_subscription_lib/common/config/grpc_mux_subscription_impl.h:70] gRPC config for type.googleapis.com/envoy.api.v2.ClusterLoadAssignment rejected: Unknown address resolver: LOGICAL_DNS. Consider setting resolver_name or setting cluster type to 'STRICT_DNS' or 'LOGICAL_DNS'.

Is docker hostname via EDS cluster not supported yet or am I missing something?

@9len
Copy link

9len commented Jun 27, 2018

Unfortunately, while you can set the cluster type to LOGICAL_DNS in a statically configured cluster, AFAIK there is no way to set a CDS/EDS cluster to use logical DNS. It's a hole in the API.

The way we solve this in rotor is to resolve the DNS entry within the control-plane, and hand out resolved IPs in EDS.

@oneamitj
Copy link
Author

oneamitj commented Jul 3, 2018

Below code worked for me. webapp-service is my docker service name. This way envoy resolves webapp-service to as many IPs as its replica count.

var hosts []*core.Address
dnsRefreshRate := 15 * time.Second
hosts = append(hosts, &core.Address{
	Address: &core.Address_SocketAddress{
		SocketAddress: &core.SocketAddress{
			Protocol:     core.TCP,
			Address:      "webapp-service", // webapp-service is a docker service name
			ResolverName: "STRICT_DNS",
			PortSpecifier: &core.SocketAddress_PortValue{
				PortValue: uint32(8080),
			},
		},
	},
})
cluster := &v2.Cluster{
	Name:            "my_cluster",
	ConnectTimeout:  5 * time.Second,
	Type:            v2.Cluster_STRICT_DNS,
	LbPolicy:        v2.Cluster_ROUND_ROBIN,
	Hosts:           hosts,
	DnsLookupFamily: v2.Cluster_V4_ONLY,
	DnsRefreshRate:  &dnsRefreshRate,
}

@9len
Copy link

9len commented Jul 3, 2018

Yes, the other way to do this is to embed the hostlist directly in the cluster response, rather than using EDS at all.

@slonka
Copy link
Member

slonka commented Nov 20, 2018

@9len

Unfortunately, while you can set the cluster type to LOGICAL_DNS in a statically configured cluster, AFAIK there is no way to set a CDS/EDS cluster to use logical DNS. It's a hole in the API.

Is this still the case?

@9len
Copy link

9len commented Nov 20, 2018

AFAIK yes, but I haven’t been involved with the project for several months.

@oneamitj
Copy link
Author

The alternative solution I provided seems no more of use (from v1.9). As Hosts in the cluster is now deprecated by LoadAssignment of type *ClusterLoadAssignment which uses EDS Cluster. This is troublesome for me too. I am staying at v1.8, as I use Docker as host and need to resolve docker service hostname to (multiple) IP.
In hope support for LOGICAL_DNS in EDS/CDS cluster will be added.
PS: Is there anything we can do to make this support added?

@alecholmez
Copy link
Contributor

Handing out resolved IPs in the server before they make it to the proxies is the best solution for this. It's a relatively trivial fix as well

@pravin-singhal
Copy link

I have been using LOGICAL_DNS with envoy container starting with --dns, run dnsmasq at at the IP which can route to different DNS servers based on domains

@github-actions
Copy link

github-actions bot commented Apr 6, 2021

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Apr 6, 2021
@github-actions
Copy link

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions.

@binpatel31
Copy link

is this issue resolved? can we resolve DNS name with EDS as config?

@oneamitj
Copy link
Author

@binpatel31 I don't think we can. Though, I haven't checked the latest version.

@arttkach
Copy link

arttkach commented Apr 23, 2022

I also would like to know if this issue was addressed. Static config does work but it don't seem to be working for my dynamic config. Whenever I replace an IP with a service name, in my EDS file, I get the following error:
[warning][config] [source/common/config/filesystem_subscription_impl.cc:60] Filesystem config update rejected: malformed IP address: service. Consider setting resolver_name or setting cluster type to 'STRICT_DNS' or 'LOGICAL_DNS'.
I run envoy in a container. Any plans to address this in the near future?

@20harshal
Copy link

20harshal commented Jul 13, 2022

In the attention note of https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/endpoint/v3/endpoint_components.proto#config-endpoint-v3-endpoint
The form of host address depends on the given cluster type. For STATIC or EDS, it is expected to be a direct IP address (or something resolvable by the specified resolver in the Address). For LOGICAL or STRICT DNS, it is expected to be hostname, and will be resolved via DNS.
But its saying [2022-07-20 16:58:29.848][6194][warning][config] [external/envoy/source/common/config/filesystem_subscription_impl.cc:43] Filesystem config update rejected: Error adding/updating listener(s) tcp_1: Unknown address resolver: 8.8.8.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants