https://pulumi.com logo
#general
Title
# general
e

early-match-56268

07/07/2019, 8:13 PM
@high-translator-22614 Yep you're right, thanks. Was able to get it using:
Copy code
import * as k8s from '@kubernetes/client-node'
import { devKubeconfig } from '../cluster'

export const ingressIpAddress = devKubeconfig.apply(config => {
    const kc = new k8s.KubeConfig()
    kc.loadFromString(config)
    const api = kc.makeApiClient(k8s.CoreV1Api)
    return api.readNamespacedService('istio-ingressgateway', 'istio-system').then(svc => {
        let ipAddress = ''
        if (svc.body.status) {
            const status = svc.body.status
            if (status.loadBalancer) {
                const lb = status.loadBalancer
                if (lb.ingress) {
                    const ingress = lb.ingress
                    if (ingress[0].ip) {
                        ipAddress = ingress[0].ip
                    }
                }
            }
        }
        return ipAddress
    })
})