Consul Connect Kubernetes webhook injector doesn't works in IPv6-only host.
- Dominant language
- Go
- Stars
- 30.1k
- Forks
- 4.6k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 39
Description
#### Overview of the Issue
In the IPv6-only cluster, the HOST_IP is resolved to for example `fc00:f853:ccd:e793::2`.
In the injected sidecar, the `CONSUL_HTTP_ADDR` environment variable is resolved to `https://$(HOST_IP):8501`, which the following error message will be thrown on the sidecar container startup:
```
Invalid Consul HTTP address: address fc00:f853:ccd:e793::5:8502: too many colons in address
```
Snippet of sidecar YAML
```
- command:
- envoy
- --config-path
- /consul/connect-inject/envoy-bootstrap.yaml
env:
- name: HOST_IP
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.hostIP
- name: CONSUL_CACERT
value: /consul/connect-inject/consul-ca.pem
- name: CONSUL_HTTP_ADDR
value: https://$(HOST_IP):8501
image: dependencies.openet.com:5000/envoyproxy/envoy-alpine:v1.16.0
imagePullPolicy: IfNotPresent
lifecycle:
preStop:
exec:
command:
- /bin/sh
- -ec
- |-
/consul/connect-inject/consul services deregister \
-token-file="/consul/connect-inject/acl-token" \
/consul/connect-inject/service.hcl
/consul/connect-inject/consul logout \
-token-file="/consul/connect-inject/acl-token"
name: consul-connect-envoy-sidecar
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /consul/connect-inject
name: consul-connect-inject-data
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
name: consul-test-client-token-7lx6f
readOnly: true
```
For Kubernetes environment, a separated issue was raised https://github.com/hashicorp/consul-helm/issues/969.
#### Reproduction Steps
Steps to reproduce this issue:
1. Create a cluster with IPv6-only networking
1. Install the Consul with Consul Connect enabled (it may not works until https://github.com/hashicorp/consul-helm/issues/969 is resolved).
1. Create a client with the Consul Connect annotation, trigger the sidecar injection.
### Consul info for Server
Server info
```
agent:
check_monitors = 0
check_ttls = 0
checks = 0
services = 0
build:
prerelease =
revision = 3c1c2267
version = 1.9.5
consul:
acl = enabled
bootstrap = false
known_datacenters = 2
leader = false
leader_addr = [fd00:10:244:2::e]:8300
server = true
raft:
applied_index = 1261
commit_index = 1261
fsm_pending = 0
last_contact = 7.298247ms
last_log_index = 1261
last_log_term = 2
last_snapshot_index = 0
last_snapshot_term = 0
latest_configuration = [{Suffrage:Voter ID:50620f37-99a2-cb00-ca57-ba7c894df8e3 Address:[fd00:10:244:1::15]:8300} {Suffrage:Voter ID:d9e7c8f0-e832-0662-9ca9-e7c2d0287b37 Address:[fd00:10:244:2::e]:8300}]
latest_configuration_index = 0
num_peers = 1
protocol_version = 3
protocol_version_max = 3
protocol_version_min = 0
snapshot_version_max = 1
snapshot_version_min = 0
state = Follower
term = 2
runtime:
arch = amd64
cpu_count = 4
goroutines = 200
max_procs = 4
os = linux
version = go1.15.8
serf_lan:
coordinate_resets = 0
encrypted = true
event_queue = 0
event_time = 2
failed = 0
health_score = 0
intent_queue = 0
left = 0
member_time = 6
members = 5
query_queue = 0
query_time = 1
serf_wan:
coordinate_resets = 0
encrypted = true
event_queue = 0
event_time = 1
failed = 0
health_score = 7
intent_queue = 0
left = 0
member_time = 2
members = 2
query_queue = 0
query_time = 1
```
### Operating system and Environment details
Kubernetes version
```
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.0", GitCommit:"cb303e613a121a29364f75cc67d3d580833a7479", GitTreeState:"clean", BuildDate:"2021-04-08T16:31:21Z", GoVersion:"go1.16.1", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.2", GitCommit:"faecb196815e248d3ecfb03c680a4507229c2a56", GitTreeState:"clean", BuildDate:"2021-01-21T01:11:42Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}
```
Contributor guide
Research direction
Reproduce the issue in an IPv6-only Kubernetes cluster and inspect the generated injected sidecar YAML, especially HOST_IP and CONSUL_HTTP_ADDR. Verify the resulting Consul address is accepted by the sidecar and that the injected container starts successfully without the reported colon-parsing error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- infrastructure, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100