Skip to content

Commit e8087b3

Browse files
committed
Remove the limitation on exposing port 10250 externally
1 parent 1e55df4 commit e8087b3

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

pkg/apis/core/validation/validation.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ import (
5858
podshelper "k8s.io/kubernetes/pkg/apis/core/pods"
5959
corev1 "k8s.io/kubernetes/pkg/apis/core/v1"
6060
"k8s.io/kubernetes/pkg/capabilities"
61-
"k8s.io/kubernetes/pkg/cluster/ports"
6261
"k8s.io/kubernetes/pkg/features"
6362
"k8s.io/kubernetes/pkg/fieldpath"
6463
)
@@ -5762,16 +5761,6 @@ func ValidateService(service *core.Service) field.ErrorList {
57625761
}
57635762
switch service.Spec.Type {
57645763
case core.ServiceTypeLoadBalancer:
5765-
for ix := range service.Spec.Ports {
5766-
port := &service.Spec.Ports[ix]
5767-
// This is a workaround for broken cloud environments that
5768-
// over-open firewalls. Hopefully it can go away when more clouds
5769-
// understand containers better.
5770-
if port.Port == ports.KubeletPort {
5771-
portPath := specPath.Child("ports").Index(ix)
5772-
allErrs = append(allErrs, field.Invalid(portPath, port.Port, fmt.Sprintf("may not expose port %v externally since it is used by kubelet", ports.KubeletPort)))
5773-
}
5774-
}
57755764
if isHeadlessService(service) {
57765765
allErrs = append(allErrs, field.Invalid(specPath.Child("clusterIPs").Index(0), service.Spec.ClusterIPs[0], "may not be set to 'None' for LoadBalancer services"))
57775766
}

pkg/apis/core/validation/validation_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15385,16 +15385,15 @@ func TestValidateServiceCreate(t *testing.T) {
1538515385
},
1538615386
numErrs: 0,
1538715387
}, {
15388-
// For now we open firewalls, and its insecure if we open 10250, remove this
15389-
// when we have better protections in place.
15390-
name: "invalid port type=LoadBalancer",
15388+
// Remove the limitation on exposing port 10250 externally
15389+
name: "valid port type=LoadBalancer",
1539115390
tweakSvc: func(s *core.Service) {
1539215391
s.Spec.Type = core.ServiceTypeLoadBalancer
1539315392
s.Spec.ExternalTrafficPolicy = core.ServiceExternalTrafficPolicyCluster
1539415393
s.Spec.AllocateLoadBalancerNodePorts = utilpointer.Bool(true)
1539515394
s.Spec.Ports = append(s.Spec.Ports, core.ServicePort{Name: "kubelet", Port: 10250, Protocol: "TCP", TargetPort: intstr.FromInt32(12345)})
1539615395
},
15397-
numErrs: 1,
15396+
numErrs: 0,
1539815397
}, {
1539915398
name: "valid LoadBalancer source range annotation",
1540015399
tweakSvc: func(s *core.Service) {

0 commit comments

Comments
 (0)