k8s-helpers/get_pod_ip
k8s-helpers/get_pod_ip/get_pod_ip.go
Update dockerfile to not rely on PATH. Just use the absolute path to the binary, it's not like we don't know where it is...
1 package main
3 import (
4 "fmt"
5 "github.com/GoogleCloudPlatform/kubernetes/pkg/client"
6 "os"
7 )
9 func main() {
10 k8s, err := client.NewInCluster()
11 if err != nil {
12 panic(err)
13 }
14 hostname, err := os.Hostname()
15 if err != nil {
16 panic(err)
17 }
18 pod, err := k8s.Pods("default").Get(hostname)
19 if err != nil {
20 panic(err)
21 }
22 fmt.Println(pod.Status.PodIP)
23 }