I'm trying to get information on a service in Kube...
# kubernetes
b
I'm trying to get information on a service in Kubernetes using Python, to no avail:
Copy code
kubernetes.core.v1.Service.get("service", "kube-dns",
                               opts=pulumi.ResourceOptions(provider=kubernetes_provider))
This results in
Preview failed: resource 'kube-dns' does not exist
But:
Copy code
$ kubectl --kubeconfig /tmp/kubeconfig get svc -n kube-system kube-dns
NAME       TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)         AGE
kube-dns   ClusterIP   10.100.0.10   <none>        53/UDP,53/TCP   3d22h
And yes, my kubernetes_provider is using the
kube-system
namespace
g
You need to specify the namespace in the
get
call. Should be
kube-system/kube-dns
in this case
b
Thanks, that works! Unfortunately I get another error:
Copy code
error: Preview failed: 2 errors occurred:
        * Resource 'kube-dns' 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
It's the whole point of this exercise. I need to get the IP of the service so that I can redeploy and have the pods start. EKS is very silly in this Fargate exclusion limitation.
I would be extremely happy if I can just get some YAML out of Kubernetes
g
Hmm, I wouldn’t have expected it to run a readiness check on a
.get
like that. I think that’s a bug.
Just to confirm, is that the same resource giving the error?
b
Yes
Just to clarify, this is a service that comes by default with EKS. I need to get some information from it - namely the cluster IP -, so I can apply a new template from AWS and fix the pods.
b
Are you planning on patching this resource with Pulumi? If so, an import would get you there quicker
b
Should I submit a bug report?
The fix is to get a YAML file from AWS, make some changes and then apply it, which I plan to do with Pulumi and kubernetes.yaml.
The problem with import is that I can't do it in one go, it requires manual intervention, which is not ideal when dealing with multiple accounts.
g
Yeah, could you file a bug report on the
.get
failing a readiness check?
b
Really appreciate all the help. I've submitted the ticket: https://github.com/pulumi/pulumi-kubernetes/issues/1238
👍 1