Skip to content

Commit 9945105

Browse files
feat: support exposing clusterIP services via minikube service
1 parent 9f22db8 commit 9945105

File tree

10 files changed

+24
-0
lines changed

10 files changed

+24
-0
lines changed

cmd/minikube/cmd/service.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ You may select another namespace by using 'minikube service {{.service}} -n <nam
119119
}
120120

121121
var data [][]string
122+
var noNodePortServices service.URLs
123+
122124
for _, svc := range services {
123125
openUrls, err := service.WaitForService(co.API, co.Config.Name, namespace, svc.Name, serviceURLTemplate, serviceURLMode, https, wait, interval)
124126

@@ -133,6 +135,7 @@ You may select another namespace by using 'minikube service {{.service}} -n <nam
133135

134136
if len(openUrls) == 0 {
135137
data = append(data, []string{svc.Namespace, svc.Name, "No node port"})
138+
noNodePortServices = append(noNodePortServices, svc)
136139
} else {
137140
servicePortNames := strings.Join(svc.PortNames, "\n")
138141
serviceURLs := strings.Join(openUrls, "\n")
@@ -154,10 +157,22 @@ You may select another namespace by using 'minikube service {{.service}} -n <nam
154157
}
155158
}
156159

160+
noNodePortSvcNames := []string{}
161+
for _, svc := range noNodePortServices {
162+
noNodePortSvcNames = append(noNodePortSvcNames, fmt.Sprintf("%s/%s", svc.Namespace, svc.Name))
163+
}
164+
if len(noNodePortServices) != 0 {
165+
out.WarningT("The following services are clusterIP services: {{.svc_names}}, which are supposed to be accessable inside the cluster only. Minikube allows you to access them by opening an SSH tunnel, which is only for test purpose and must not be used in production environment", out.V{"svc_names": noNodePortSvcNames})
166+
}
167+
157168
if driver.NeedsPortForward(co.Config.Driver) && services != nil {
158169
startKicServiceTunnel(services, cname, co.Config.Driver)
159170
} else if !serviceURLMode {
160171
openURLs(data)
172+
if len(noNodePortServices) != 0 {
173+
startKicServiceTunnel(noNodePortServices, cname, co.Config.Driver)
174+
}
175+
161176
}
162177
},
163178
}

translations/de.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@
730730
"The driver '{{.driver}}' is not supported on {{.os}}/{{.arch}}": "Der Treiber '{{.driver}}' wird auf {{.os}}/{{.arch}} nicht unterstützt",
731731
"The existing \"{{.name}}\" cluster was created using the \"{{.old}}\" driver, which is incompatible with requested \"{{.new}}\" driver.": "Der existierende \"{{.name}}\" Cluster wurde mit dem alten Treiber \"{{.old}}\" erstellt, welcher inkompatibel ist mit dem Treiber \"{{.new}}\".",
732732
"The existing node configuration appears to be corrupt. Run 'minikube delete'": "Die existierende Node Konfiguration scheint defekt. Starte 'minikube delete'",
733+
"The following services are clusterIP services: {{.svc_names}}, which are supposed to be accessable inside the cluster only. Minikube allows you to access them by opening an SSH tunnel, which is only for test purpose and must not be used in production environment": "",
733734
"The heapster addon is depreciated. please try to disable metrics-server instead": "Das heapster Addon ist veraltet (deprecated). Bitte deaktiviere stattdessen den Metris-Server.",
734735
"The hyperv virtual switch name. Defaults to first found. (hyperv driver only)": "Der Name des virtuellen Hyperv-Switch. Standardmäßig zuerst gefunden. (nur Hyperv-Treiber)",
735736
"The hypervisor does not appear to be configured properly. Run 'minikube start --alsologtostderr -v=1' and inspect the error code": "Der Hypervisor wurde scheinbar nicht korrekt konfiguriert. Starte 'minikube start --alsologtostderr -v=1' und inspiziere den Fehler-Code",

translations/es.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,7 @@
726726
"The driver '{{.driver}}' is not supported on {{.os}}/{{.arch}}": "El controlador \"{{.driver}}\" no se puede utilizar en {{.os}}/{{.arch}}",
727727
"The existing \"{{.name}}\" cluster was created using the \"{{.old}}\" driver, which is incompatible with requested \"{{.new}}\" driver.": "",
728728
"The existing node configuration appears to be corrupt. Run 'minikube delete'": "",
729+
"The following services are clusterIP services: {{.svc_names}}, which are supposed to be accessable inside the cluster only. Minikube allows you to access them by opening an SSH tunnel, which is only for test purpose and must not be used in production environment": "",
729730
"The heapster addon is depreciated. please try to disable metrics-server instead": "",
730731
"The hyperv virtual switch name. Defaults to first found. (hyperv driver only)": "El nombre del conmutador virtual de hyperv. El valor predeterminado será el primer nombre que se encuentre (solo con el controlador de hyperv).",
731732
"The hypervisor does not appear to be configured properly. Run 'minikube start --alsologtostderr -v=1' and inspect the error code": "",

translations/fr.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,7 @@
717717
"The driver '{{.driver}}' is not supported on {{.os}}/{{.arch}}": "Le pilote \"{{.driver}}\" n'est pas compatible avec {{.os}}/{{.arch}}.",
718718
"The existing \"{{.name}}\" cluster was created using the \"{{.old}}\" driver, which is incompatible with requested \"{{.new}}\" driver.": "Le cluster \"{{.name}}\" existant a été créé à l'aide du pilote \"{{.old}}\", qui est incompatible avec le pilote \"{{.new}}\" demandé.",
719719
"The existing node configuration appears to be corrupt. Run 'minikube delete'": "La configuration de nœud existante semble être corrompue. Exécutez 'minikube delete'",
720+
"The following services are clusterIP services: {{.svc_names}}, which are supposed to be accessable inside the cluster only. Minikube allows you to access them by opening an SSH tunnel, which is only for test purpose and must not be used in production environment": "",
720721
"The heapster addon is depreciated. please try to disable metrics-server instead": "Le module heapster est déprécié. s'il vous plaît essayez de désactiver metrics-server à la place",
721722
"The hyperv virtual switch name. Defaults to first found. (hyperv driver only)": "Nom du commutateur virtuel hyperv. La valeur par défaut affiche le premier commutateur trouvé (pilote hyperv uniquement).",
722723
"The hypervisor does not appear to be configured properly. Run 'minikube start --alsologtostderr -v=1' and inspect the error code": "L'hyperviseur ne semble pas être configuré correctement. Exécutez 'minikube start --alsologtostderr -v=1' et inspectez le code d'erreur",

translations/ja.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,7 @@
687687
"The driver '{{.driver}}' is not supported on {{.os}}/{{.arch}}": "'{{.driver}}' ドライバーは {{.os}}/{{.arch}} に対応していません",
688688
"The existing \"{{.name}}\" cluster was created using the \"{{.old}}\" driver, which is incompatible with requested \"{{.new}}\" driver.": "既存の「{{.name}}」クラスターは、(要求された「{{.new}}」ドライバーとは互換性のない)「{{.old}}」ドライバーを使用して作成されました。 ",
689689
"The existing node configuration appears to be corrupt. Run 'minikube delete'": "既存のノード設定が破損しているようです。'minikube delete' を実行してください",
690+
"The following services are clusterIP services: {{.svc_names}}, which are supposed to be accessable inside the cluster only. Minikube allows you to access them by opening an SSH tunnel, which is only for test purpose and must not be used in production environment": "",
690691
"The heapster addon is depreciated. please try to disable metrics-server instead": "heapster アドオンは廃止予定です。代わりに metrics-server を無効化してみてください",
691692
"The hyperv virtual switch name. Defaults to first found. (hyperv driver only)": "hyperv 仮想スイッチ名。デフォルト値は最初に見つかったスイッチ名です。 (hyperv ドライバーのみ)",
692693
"The hypervisor does not appear to be configured properly. Run 'minikube start --alsologtostderr -v=1' and inspect the error code": "ハイパーバイザーが適切に設定されていないようです。'minikube start --alsologtostderr -v=1' を実行してエラーコードを確認してください",

translations/ko.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@
730730
"The driver '{{.driver}}' is not supported on {{.os}}/{{.arch}}": "",
731731
"The existing \"{{.name}}\" cluster was created using the \"{{.old}}\" driver, which is incompatible with requested \"{{.new}}\" driver.": "",
732732
"The existing node configuration appears to be corrupt. Run 'minikube delete'": "",
733+
"The following services are clusterIP services: {{.svc_names}}, which are supposed to be accessable inside the cluster only. Minikube allows you to access them by opening an SSH tunnel, which is only for test purpose and must not be used in production environment": "",
733734
"The heapster addon is depreciated. please try to disable metrics-server instead": "",
734735
"The hyperv virtual switch name. Defaults to first found. (hyperv driver only)": "",
735736
"The hypervisor does not appear to be configured properly. Run 'minikube start --alsologtostderr -v=1' and inspect the error code": "",

translations/pl.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,7 @@
737737
"The driver '{{.driver}}' is not supported on {{.os}}/{{.arch}}": "Sterownik '{{.driver}} jest niewspierany przez system {{.os}}/{{.arch}}",
738738
"The existing \"{{.name}}\" cluster was created using the \"{{.old}}\" driver, which is incompatible with requested \"{{.new}}\" driver.": "",
739739
"The existing node configuration appears to be corrupt. Run 'minikube delete'": "",
740+
"The following services are clusterIP services: {{.svc_names}}, which are supposed to be accessable inside the cluster only. Minikube allows you to access them by opening an SSH tunnel, which is only for test purpose and must not be used in production environment": "",
740741
"The heapster addon is depreciated. please try to disable metrics-server instead": "",
741742
"The hyperv virtual switch name. Defaults to first found. (hyperv driver only)": "",
742743
"The hypervisor does not appear to be configured properly. Run 'minikube start --alsologtostderr -v=1' and inspect the error code": "",

translations/ru.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,7 @@
672672
"The driver '{{.driver}}' is not supported on {{.os}}/{{.arch}}": "",
673673
"The existing \"{{.name}}\" cluster was created using the \"{{.old}}\" driver, which is incompatible with requested \"{{.new}}\" driver.": "",
674674
"The existing node configuration appears to be corrupt. Run 'minikube delete'": "",
675+
"The following services are clusterIP services: {{.svc_names}}, which are supposed to be accessable inside the cluster only. Minikube allows you to access them by opening an SSH tunnel, which is only for test purpose and must not be used in production environment": "",
675676
"The heapster addon is depreciated. please try to disable metrics-server instead": "",
676677
"The hyperv virtual switch name. Defaults to first found. (hyperv driver only)": "",
677678
"The hypervisor does not appear to be configured properly. Run 'minikube start --alsologtostderr -v=1' and inspect the error code": "",

translations/strings.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,7 @@
671671
"The driver '{{.driver}}' is not supported on {{.os}}/{{.arch}}": "",
672672
"The existing \"{{.name}}\" cluster was created using the \"{{.old}}\" driver, which is incompatible with requested \"{{.new}}\" driver.": "",
673673
"The existing node configuration appears to be corrupt. Run 'minikube delete'": "",
674+
"The following services are clusterIP services: {{.svc_names}}, which are supposed to be accessable inside the cluster only. Minikube allows you to access them by opening an SSH tunnel, which is only for test purpose and must not be used in production environment": "",
674675
"The heapster addon is depreciated. please try to disable metrics-server instead": "",
675676
"The hyperv virtual switch name. Defaults to first found. (hyperv driver only)": "",
676677
"The hypervisor does not appear to be configured properly. Run 'minikube start --alsologtostderr -v=1' and inspect the error code": "",

translations/zh-CN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,7 @@
833833
"The driver '{{.driver}}' is not supported on {{.os}}/{{.arch}}": "{{.os}} 不支持驱动程序“{{.driver}}/{{.arch}}”",
834834
"The existing \"{{.name}}\" cluster was created using the \"{{.old}}\" driver, which is incompatible with requested \"{{.new}}\" driver.": "",
835835
"The existing node configuration appears to be corrupt. Run 'minikube delete'": "",
836+
"The following services are clusterIP services: {{.svc_names}}, which are supposed to be accessable inside the cluster only. Minikube allows you to access them by opening an SSH tunnel, which is only for test purpose and must not be used in production environment": "以下服务为ClusterIP类型:{{.svc_names}}. 这些服务正常情况下只能从集群内部访问。Minikube通过ssh隧道的方式使你可以从本机访问这些服务,但此功能仅供测试用途严禁生产环境中使用",
836837
"The heapster addon is depreciated. please try to disable metrics-server instead": "",
837838
"The hyperv virtual switch name. Defaults to first found. (hyperv driver only)": "hyperv 虚拟交换机名称。默认为找到的第一个 hyperv 虚拟交换机。(仅限 hyperv 驱动程序)",
838839
"The hypervisor does not appear to be configured properly. Run 'minikube start --alsologtostderr -v=1' and inspect the error code": "管理程序似乎配置的不正确。执行 'minikube start --alsologtostderr -v=1' 并且检查错误代码",

0 commit comments

Comments
 (0)