Skip to content

Commit

Permalink
Skip outbound port 443 in control-plane
Browse files Browse the repository at this point in the history
#2349 introduced a `SelfSubjectAccessReview` check at
startup, to determine whether each control-plane component should
establish Kubernetes watches cluster-wide or namespace-wide. If this
check occurs before the linkerd-proxy sidecar is ready, it fails, and
the control-plane component restarts.

This change configures each control-plane pod to skip outbound port 443
when injecting the proxy, allowing the control-plane to connect to
Kubernetes regardless of the `linkerd-proxy` state.

A longer-term fix should involve a more robust control-plane startup,
that is resilient to failed Kubernetes API requests. An even longer-term
fix could involve injecting `linkerd-proxy` as a Kubernetes "sidecar"
container, when that becomes available.

Workaround for #2407

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
  • Loading branch information
siggy committed Feb 27, 2019
1 parent c5b9052 commit e0268c4
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cli/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ func validateAndBuildConfig(options *installOptions) (*installConfig, error) {
return nil, err
}

// TODO: these seem to not be used?
ignoreInboundPorts := []string{
fmt.Sprintf("%d", options.proxyControlPort),
fmt.Sprintf("%d", options.proxyMetricsPort),
Expand Down Expand Up @@ -321,6 +322,11 @@ func render(config installConfig, w io.Writer, options *installOptions) error {
// Special case for linkerd-proxy running in the Prometheus pod.
injectOptions.proxyOutboundCapacity[config.PrometheusImage] = prometheusProxyOutboundCapacity

// Skip outbound port 443 to enable Kubernetes API access without the proxy.
// Once Kubernetes supports sidecar containers, this may be removed, as that
// will guarantee the proxy is running prior to control-plane startup.
injectOptions.ignoreOutboundPorts = []uint{443}

return InjectYAML(&buf, w, ioutil.Discard, injectOptions)
}

Expand Down
8 changes: 8 additions & 0 deletions cli/cmd/testdata/install_default.golden
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -518,6 +520,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -699,6 +703,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -946,6 +952,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down
8 changes: 8 additions & 0 deletions cli/cmd/testdata/install_ha_output.golden
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -536,6 +538,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -723,6 +727,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -976,6 +982,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down
8 changes: 8 additions & 0 deletions cli/cmd/testdata/install_ha_with_overrides_output.golden
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -536,6 +538,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -723,6 +727,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -976,6 +982,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down
12 changes: 12 additions & 0 deletions cli/cmd/testdata/install_output.golden
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -522,6 +524,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -704,6 +708,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -952,6 +958,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -1189,6 +1197,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -1323,6 +1333,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down
10 changes: 10 additions & 0 deletions cli/cmd/testdata/install_single_namespace_output.golden
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -412,6 +414,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -596,6 +600,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -846,6 +852,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down Expand Up @@ -1085,6 +1093,8 @@ spec:
- "2102"
- --inbound-ports-to-ignore
- 4190,4191
- --outbound-ports-to-ignore
- "443"
image: gcr.io/linkerd-io/proxy-init:dev-undefined
imagePullPolicy: IfNotPresent
name: linkerd-init
Expand Down

0 comments on commit e0268c4

Please sign in to comment.