diff --git a/cmd/kubelet-starter/main.go b/cmd/kubelet-starter/main.go index d6430efea9..45ee714962 100644 --- a/cmd/kubelet-starter/main.go +++ b/cmd/kubelet-starter/main.go @@ -16,6 +16,7 @@ package main import ( "context" + "fmt" "io/ioutil" "os" "os/exec" @@ -25,6 +26,7 @@ import ( "github.com/vmware/vic/lib/config" "github.com/vmware/vic/lib/constants" + "github.com/vmware/vic/lib/portlayer/util" viclog "github.com/vmware/vic/pkg/log" "github.com/vmware/vic/pkg/log/syslog" "github.com/vmware/vic/pkg/trace" @@ -75,12 +77,27 @@ func main() { viclog.Init(logcfg) trace.InitLogger(logcfg) + // Get the port numbers for Docker and Portlayer + personaPort := os.Getenv("PERSONA_PORT") + portlayerPort := os.Getenv("PORTLAYER_PORT") + if vchConfig.Diagnostics.DebugLevel > 2 { // expose portlayer service on client interface - plPort := constants.DebugPortLayerPort - os.Setenv("PORTLAYER_ADDR", strconv.Itoa(plPort)) + portlayerPort = strconv.Itoa(constants.DebugPortLayerPort) } + clientIP, err := util.ClientIP() + + if err != nil { + op.Fatalf("Cannot get Client IP err: %s", err) + } + + personaAddr := fmt.Sprintf("%s:%s", clientIP, personaPort) + portlayerAddr := fmt.Sprintf("%s:%s", clientIP, portlayerPort) + + os.Setenv("PERSONA_ADDR", personaAddr) + os.Setenv("PORTLAYER_ADDR", portlayerAddr) + op.Infof("KUBELET_NAME = %s", os.Getenv("KUBELET_NAME")) op.Infof("KUBERNETES_SERVICE_HOST = %s", os.Getenv("KUBERNETES_SERVICE_HOST")) op.Infof("KUBERNETES_SERVICE_PORT = %s", os.Getenv("KUBERNETES_SERVICE_PORT")) diff --git a/cmd/vicadmin/vicadm.go b/cmd/vicadmin/vicadm.go index c0785a3449..1259994ddd 100644 --- a/cmd/vicadmin/vicadm.go +++ b/cmd/vicadmin/vicadm.go @@ -76,6 +76,8 @@ var ( "port-layer.log", "vicadmin.log", "init.log", + "kubelet-starter.log", + "virtual-kubelet.log", } // VMFiles is the set of files to collect per VM associated with the VCH diff --git a/isos/vicadmin/dashboard.html b/isos/vicadmin/dashboard.html index 247a8cc0bc..20859b17d6 100644 --- a/isos/vicadmin/dashboard.html +++ b/isos/vicadmin/dashboard.html @@ -101,6 +101,14 @@

Logs

Admin Server
Live Log
+
+
Kubelet Starter
+
Live Log
+
+
+
Virtual Kubelet
+
Live Log
+
{{else}}
diff --git a/lib/install/management/appliance.go b/lib/install/management/appliance.go index b6816ed8ad..269e3df1d9 100644 --- a/lib/install/management/appliance.go +++ b/lib/install/management/appliance.go @@ -624,8 +624,8 @@ func (d *Dispatcher) createAppliance(conf *config.VirtualContainerHostConfigSpec kubeletStarter.Env = append(kubeletStarter.Env, fmt.Sprintf("%s=%s", "KUBELET_NAME", kubeletName)) // Set up the persona and port layer - kubeletStarter.Env = append(kubeletStarter.Env, fmt.Sprintf("%s=%s:%s", "PERSONA_ADDR", "localhost", d.DockerPort)) - kubeletStarter.Env = append(kubeletStarter.Env, fmt.Sprintf("%s=%s:%d", "PORTLAYER_ADDR", "localhost", portLayerPort)) + kubeletStarter.Env = append(kubeletStarter.Env, fmt.Sprintf("%s=%s", "PERSONA_PORT", d.DockerPort)) + kubeletStarter.Env = append(kubeletStarter.Env, fmt.Sprintf("%s=%d", "PORTLAYER_PORT", portLayerPort)) if settings.HTTPProxy != nil { kubeletStarter.Env = append(kubeletStarter.Env, fmt.Sprintf("%s=%s", config.GeneralHTTPProxy, settings.HTTPProxy.String()))