Skip to content

Commit 9718f37

Browse files
jpaodevhessjcg
andauthored
fix: migrate away from kube-rbac-proxy (critical) (#747)
Co-authored-by: Jonathan Hess (he/him) <103529393+hessjcg@users.noreply.github.com>
1 parent 1fa6322 commit 9718f37

File tree

3 files changed

+11
-28
lines changed

3 files changed

+11
-28
lines changed

config/default/kustomization.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ bases:
3535
#- ../prometheus
3636
patchesStrategicMerge:
3737
# Protect the /metrics endpoint by putting it behind auth.
38+
# Configure the controller-manager to serve metrics securely using
39+
# controller-runtime's built-in authentication and authorization.
3840
# If you want your controller-manager to expose the /metrics
3941
# endpoint w/o any authn/z, please comment the following line.
4042
- manager_auth_proxy_patch.yaml

config/default/manager_auth_proxy_patch.yaml

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
# This patch inject a sidecar container which is a HTTP proxy for the
15-
# controller manager, it performs RBAC authorization against the Kubernetes API using SubjectAccessReviews.
14+
# This patch configures the controller manager to expose metrics on port 8443.
15+
# Access is controlled via Kubernetes RBAC on the metrics service.
1616
apiVersion: apps/v1
1717
kind: Deployment
1818
metadata:
@@ -22,31 +22,12 @@ spec:
2222
template:
2323
spec:
2424
containers:
25-
- name: kube-rbac-proxy
26-
securityContext:
27-
allowPrivilegeEscalation: false
28-
capabilities:
29-
drop:
30-
- "ALL"
31-
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.13.0
25+
- name: manager
3226
args:
33-
- "--secure-listen-address=0.0.0.0:8443"
34-
- "--upstream=http://127.0.0.1:8080/"
35-
- "--logtostderr=true"
36-
- "--v=0"
27+
- "--health-probe-bind-address=:8081"
28+
- "--metrics-bind-address=:8443"
29+
- "--leader-elect"
3730
ports:
3831
- containerPort: 8443
3932
protocol: TCP
4033
name: https
41-
resources:
42-
limits:
43-
cpu: 500m
44-
memory: 128Mi
45-
requests:
46-
cpu: 5m
47-
memory: 64Mi
48-
- name: manager
49-
args:
50-
- "--health-probe-bind-address=:8081"
51-
- "--metrics-bind-address=127.0.0.1:8080"
52-
- "--leader-elect"

config/rbac/kustomization.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ resources:
2222
- role_binding.yaml
2323
- leader_election_role.yaml
2424
- leader_election_role_binding.yaml
25-
# Comment the following 4 lines if you want to disable
26-
# the Auth Proxy (https://github.com/brancz/kube-rbac-proxy)
27-
# which protects your /metrics endpoint.
25+
# The following resources are required for the controller-runtime's
26+
# built-in metrics authentication and authorization.
27+
# Comment these lines if you want to disable secure metrics.
2828
- auth_proxy_service.yaml
2929
- auth_proxy_role.yaml
3030
- auth_proxy_role_binding.yaml

0 commit comments

Comments
 (0)