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

clean-engineer-75963

10/04/2019, 5:44 PM
Pulumi is getting stuck trying to create a headless Kubernetes service.
Specifically, it sits in "creating..." with "Finding Pods to direct traffic to"
Service code:
Copy code
etcd_service = corev1.Service(
    "etcd",
    metadata={
        "name": "etcd",
        "namespace": base_namespace.metadata["name"],
    },
    spec={
        "clusterIP": "None",
        "ports": [
            {
                "name": "peers",
                "port": 2380,
                "protocol": "TCP",
                "targetPort": 2380,
            },
            {
                "name": "clients",
                "port": 2379,
                "protocol": "TCP",
                "targetPort": 2379,
            },
        ],
        "selector": {
            "component": "etcd",
        },
    },
)
I also tried a literal Python
None
for
"clusterIP"
and got the same result (pretty sure, though, that that's not the right thing to do).
This service is for use by an etcd StatefulSet, which isn't created until after this, so it's never going to find any Pods at this step.
I can always try turning off the await to skip this validation, but the docs seem to say this should work.
Oh, I see. It needs to be headless AND empty (e.g., no
selector
. So I guess I just need to create the StatefulSet first.
I was hoping I could pass
etcd_service.metadata["name"]
to the StatefulSet's spec.ServiceName to DRY this out, but I guess I can't do that.
g

gorgeous-egg-16927

10/04/2019, 7:30 PM
c

clean-engineer-75963

10/04/2019, 8:17 PM
Yeah, that looks like the same issue. I don't think it's due to auto-naming, though (mine are not auto-named).
g

gorgeous-egg-16927

10/04/2019, 8:34 PM
Can you update the issue with that info?
c

creamy-potato-29402

10/04/2019, 11:28 PM
@clean-engineer-75963 you can use the
skip-await
annottion to get around this