Merge pull request #102121 from pacoxu/remove-insecure-ports
kubeadm: remove --insecure-port flag from the kube-apiserver manifest
This commit is contained in:
		| @@ -133,7 +133,6 @@ func CreateStaticPodFiles(manifestDir, patchesDir string, cfg *kubeadmapi.Cluste | ||||
| func getAPIServerCommand(cfg *kubeadmapi.ClusterConfiguration, localAPIEndpoint *kubeadmapi.APIEndpoint) []string { | ||||
| 	defaultArguments := map[string]string{ | ||||
| 		"advertise-address":                localAPIEndpoint.AdvertiseAddress, | ||||
| 		"insecure-port":                    "0", | ||||
| 		"enable-admission-plugins":         "NodeRestriction", | ||||
| 		"service-cluster-ip-range":         cfg.Networking.ServiceSubnet, | ||||
| 		"service-account-key-file":         filepath.Join(cfg.CertificatesDir, kubeadmconstants.ServiceAccountPublicKeyName), | ||||
|   | ||||
| @@ -204,7 +204,6 @@ func TestGetAPIServerCommand(t *testing.T) { | ||||
| 			endpoint: &kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"}, | ||||
| 			expected: []string{ | ||||
| 				"kube-apiserver", | ||||
| 				"--insecure-port=0", | ||||
| 				"--enable-admission-plugins=NodeRestriction", | ||||
| 				"--service-cluster-ip-range=bar", | ||||
| 				"--service-account-key-file=" + testCertsDir + "/sa.pub", | ||||
| @@ -243,7 +242,6 @@ func TestGetAPIServerCommand(t *testing.T) { | ||||
| 			endpoint: &kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "2001:db8::1"}, | ||||
| 			expected: []string{ | ||||
| 				"kube-apiserver", | ||||
| 				"--insecure-port=0", | ||||
| 				"--enable-admission-plugins=NodeRestriction", | ||||
| 				"--service-cluster-ip-range=bar", | ||||
| 				"--service-account-key-file=" + testCertsDir + "/sa.pub", | ||||
| @@ -290,7 +288,6 @@ func TestGetAPIServerCommand(t *testing.T) { | ||||
| 			endpoint: &kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "2001:db8::1"}, | ||||
| 			expected: []string{ | ||||
| 				"kube-apiserver", | ||||
| 				"--insecure-port=0", | ||||
| 				"--enable-admission-plugins=NodeRestriction", | ||||
| 				"--service-cluster-ip-range=bar", | ||||
| 				"--service-account-key-file=" + testCertsDir + "/sa.pub", | ||||
| @@ -334,7 +331,6 @@ func TestGetAPIServerCommand(t *testing.T) { | ||||
| 			endpoint: &kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "2001:db8::1"}, | ||||
| 			expected: []string{ | ||||
| 				"kube-apiserver", | ||||
| 				"--insecure-port=0", | ||||
| 				"--enable-admission-plugins=NodeRestriction", | ||||
| 				"--service-cluster-ip-range=bar", | ||||
| 				"--service-account-key-file=" + testCertsDir + "/sa.pub", | ||||
| @@ -380,7 +376,6 @@ func TestGetAPIServerCommand(t *testing.T) { | ||||
| 			endpoint: &kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"}, | ||||
| 			expected: []string{ | ||||
| 				"kube-apiserver", | ||||
| 				"--insecure-port=0", | ||||
| 				"--enable-admission-plugins=NodeRestriction", | ||||
| 				"--service-cluster-ip-range=baz", | ||||
| 				"--service-account-key-file=" + testCertsDir + "/sa.pub", | ||||
| @@ -428,7 +423,6 @@ func TestGetAPIServerCommand(t *testing.T) { | ||||
| 			endpoint: &kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"}, | ||||
| 			expected: []string{ | ||||
| 				"kube-apiserver", | ||||
| 				"--insecure-port=0", | ||||
| 				"--enable-admission-plugins=NodeRestriction", | ||||
| 				"--service-cluster-ip-range=bar", | ||||
| 				"--service-account-key-file=" + testCertsDir + "/sa.pub", | ||||
| @@ -458,52 +452,6 @@ func TestGetAPIServerCommand(t *testing.T) { | ||||
| 				"--etcd-keyfile=" + testCertsDir + "/apiserver-etcd-client.key", | ||||
| 			}, | ||||
| 		}, | ||||
| 		{ | ||||
| 			name: "insecure-port extra-args", | ||||
| 			cfg: &kubeadmapi.ClusterConfiguration{ | ||||
| 				Networking:      kubeadmapi.Networking{ServiceSubnet: "bar", DNSDomain: "cluster.local"}, | ||||
| 				CertificatesDir: testCertsDir, | ||||
| 				APIServer: kubeadmapi.APIServer{ | ||||
| 					ControlPlaneComponent: kubeadmapi.ControlPlaneComponent{ | ||||
| 						ExtraArgs: map[string]string{ | ||||
| 							"insecure-port": "1234", | ||||
| 						}, | ||||
| 					}, | ||||
| 				}, | ||||
| 			}, | ||||
| 			endpoint: &kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"}, | ||||
| 			expected: []string{ | ||||
| 				"kube-apiserver", | ||||
| 				"--insecure-port=1234", | ||||
| 				"--enable-admission-plugins=NodeRestriction", | ||||
| 				"--service-cluster-ip-range=bar", | ||||
| 				"--service-account-key-file=" + testCertsDir + "/sa.pub", | ||||
| 				"--service-account-signing-key-file=" + testCertsDir + "/sa.key", | ||||
| 				"--service-account-issuer=https://kubernetes.default.svc.cluster.local", | ||||
| 				"--client-ca-file=" + testCertsDir + "/ca.crt", | ||||
| 				"--tls-cert-file=" + testCertsDir + "/apiserver.crt", | ||||
| 				"--tls-private-key-file=" + testCertsDir + "/apiserver.key", | ||||
| 				"--kubelet-client-certificate=" + testCertsDir + "/apiserver-kubelet-client.crt", | ||||
| 				"--kubelet-client-key=" + testCertsDir + "/apiserver-kubelet-client.key", | ||||
| 				"--enable-bootstrap-token-auth=true", | ||||
| 				"--secure-port=123", | ||||
| 				"--allow-privileged=true", | ||||
| 				"--kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname", | ||||
| 				"--proxy-client-cert-file=/var/lib/certs/front-proxy-client.crt", | ||||
| 				"--proxy-client-key-file=/var/lib/certs/front-proxy-client.key", | ||||
| 				"--requestheader-username-headers=X-Remote-User", | ||||
| 				"--requestheader-group-headers=X-Remote-Group", | ||||
| 				"--requestheader-extra-headers-prefix=X-Remote-Extra-", | ||||
| 				"--requestheader-client-ca-file=" + testCertsDir + "/front-proxy-ca.crt", | ||||
| 				"--requestheader-allowed-names=front-proxy-client", | ||||
| 				"--authorization-mode=Node,RBAC", | ||||
| 				"--advertise-address=1.2.3.4", | ||||
| 				fmt.Sprintf("--etcd-servers=https://127.0.0.1:%d", kubeadmconstants.EtcdListenClientPort), | ||||
| 				"--etcd-cafile=" + testCertsDir + "/etcd/ca.crt", | ||||
| 				"--etcd-certfile=" + testCertsDir + "/apiserver-etcd-client.crt", | ||||
| 				"--etcd-keyfile=" + testCertsDir + "/apiserver-etcd-client.key", | ||||
| 			}, | ||||
| 		}, | ||||
| 		{ | ||||
| 			name: "authorization-mode extra-args Webhook", | ||||
| 			cfg: &kubeadmapi.ClusterConfiguration{ | ||||
| @@ -524,7 +472,6 @@ func TestGetAPIServerCommand(t *testing.T) { | ||||
| 			endpoint: &kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"}, | ||||
| 			expected: []string{ | ||||
| 				"kube-apiserver", | ||||
| 				"--insecure-port=0", | ||||
| 				"--enable-admission-plugins=NodeRestriction", | ||||
| 				"--service-cluster-ip-range=bar", | ||||
| 				"--service-account-key-file=" + testCertsDir + "/sa.pub", | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Kubernetes Prow Robot
					Kubernetes Prow Robot