https://pulumi.com logo
#kubernetes
Title
# kubernetes
c

creamy-forest-42826

09/17/2020, 11:54 AM
Hi, I would like ask you for advice. I am now dealing with the creation of several pods and as input to them I need to smuggle the IP addresses of all these pods. It is some possible way? I tried following code, but services waiting on "Finding Pods to direct traffic to" and I cannot resolve
pulumi.all(...).apply(...)
Copy code
for (let i = 0; i < args.containerConf.replicas; i++) {
            const service = new k8s.core.v1.Service(
                `zooservice-${i}`,
                {
                    metadata: {
                        name: `zooservice-${i}`,
                        labels: {
                            app: ZookeeperApp,
                        },
                    },
                    spec: {
                        ports: [
                            { port: 2181, name: "client" },
                            { port: 2888, name: "server" },
                            { port: 3888, name: "leader-election" },
                        ],
                    },
                },
                {
                    parent: this,
                }
            );
            this.zkServices.push(service);
        }

        const inputIPs = this.getZookeeperServicesIPs();
        pulumi.all(inputIPs).apply((servicesIPs) => {
            servicesIPs.forEach((ip) => {
                console.log(ip);
            });
            for (let i = 0; i < args.containerConf.replicas; i++) {
                const zookeeper = new Zookeeper(
                    `zookeeper-${i}`,
                    {
                        containerConf: args.containerConf,
                        imagePullSecrets: args.imagePullSecrets,
                        serviceIPs: servicesIPs,
                    },
                    {
                        parent: this,
                    }
                );
                this.zookeepers.push(zookeeper);
            }
        });
PS: I cannot use DNS names.
We solved it with you Service type "ClusterIP" and internal vnet for IP adresses.
Copy code
type: "ClusterIP",
clusterIP: serverIp,
[Solved]
4 Views