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

icy-jordan-58549

12/08/2020, 4:44 PM
I was able to create a watcher for resources created by
operator (statefulset)
and when
service
resource has been created, I am trying to get it using something like this:
Copy code
const kc = new k8sClient.KubeConfig();
const watcher = config.servicesK8s.cluster.kubeconfig
  .apply(kubeConfig => kc.loadFromString(kubeConfig))
  .apply(() => new k8sClient.Watch(kc));

export let serviceName = watcher.apply(w => waitFor(w, 'elastic-es-http'));

export const service = pulumi
  .all([namespace.metadata.name, serviceName])
  .apply(([ns, name]) =>
    k8s.core.v1.Service.get('elastic-svc', `${ns}/${name}`, {
      parent: namespace,
      dependsOn: [elasticsearch]
    })
  );
Copy code
kubernetes:core/v1:Service (elastic-svc):
    error: 2 errors occurred:
        * Resource 'elastic-es-http' was created but failed to initialize
        * Service does not target any Pods. Selected Pods may not be ready, or field '.spec.selector' may not match labels on any Pods
keep getting this error 😞
trying to use your ideas around
watch
@gorgeous-egg-16927
(preview issue still not resolved, is it possible to say pulumi to stop resolving or do it only in apply mode)
I’ve made a setTimeout for 5sec, still doesn’t help
this doesn’t help
btw, it does work for Secret, I can’t make it working for Service. Any ideas here?
4 Views