flaky-lawyer-21437
07/30/2024, 10:05 AMpulumi:pulumi:Stack (internal-flz):
error: Program failed with an unhandled exception:
Traceback (most recent call last):
...
File "/home/osboxes/Workspace/pulumi-scripts/internal/venv/lib/python3.11/site-packages/pulumi/runtime/settings.py", line 307, in handle_grpc_error
raise grpc_error_to_exception(exn)
Exception: configured Kubernetes cluster is unreachable: unable to load schema information from the API server: Get "<https://34.140.178.210/openapi/v2?timeout=32s>": dial tcp 34.140.178.210:443: i/o timeout
Outputs:
kubeconfig: output<string>
My config is the following:
# Create a GKE Cluster in autopilot mode
cluster = gcp.container.Cluster("gke-cluster",
location=region,
enable_autopilot=True,
deletion_protection=False,
node_config={
"oauth_scopes": [
"<https://www.googleapis.com/auth/monitoring>",
"<https://www.googleapis.com/auth/devstorage.read_only>",
"<https://www.googleapis.com/auth/logging.write>",
"<https://www.googleapis.com/auth/service.management.readonly>",
"<https://www.googleapis.com/auth/servicecontrol>",
"<https://www.googleapis.com/auth/trace.append>",
],
"reservationAffinity": {
"consumeReservationType": "NO_RESERVATION",
"key": "",
"values": []
},
"reservationAffinity": {
"consumeReservationType": "NO_RESERVATION",
"key": "",
"values": []
}
}
)
# Create a global static IP
static_ip = gcp.compute.GlobalAddress("app-freelabz",
name="app-freelabz",
project=project
)
# Build a Kubeconfig to access the cluster
cluster_kubeconfig = pulumi.Output.all(
cluster.master_auth.cluster_ca_certificate,
cluster.endpoint,
cluster.name).apply(lambda l:
f"""apiVersion: v1
clusters:
- cluster:
certificate-authority-data: {l[0]}
server: https://{l[1]}
name: {l[2]}
contexts:
- context:
cluster: {l[2]}
user: {l[2]}
name: {l[2]}
current-context: {l[2]}
kind: Config
preferences: {{}}
users:
- name: {l[2]}
user:
exec:
apiVersion: client.authentication.k8s.io/v1beta1
command: gke-gcloud-auth-plugin
installHint: Install gke-gcloud-auth-plugin for use with kubectl by following
<https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke>
provideClusterInfo: true
""")
# Get the cluster credentials
k8s_provider = k8s.Provider("gke_k8s", kubeconfig=cluster_kubeconfig)
# Create a namespace
namespace = k8s.core.v1.Namespace("freelabz",
metadata={"name": "freelabz"},
opts=pulumi.ResourceOptions(provider=k8s_provider)
)
gke_cert = k8s.yaml.v2.ConfigFile("secator", file="certificate.yaml", opts=pulumi.ResourceOptions(provider=k8s_provider))
I'm starting with an empty stack ...flaky-lawyer-21437
07/30/2024, 10:17 AMgke_cert = k8s.yaml.v2.ConfigFile("secator", file="certificate.yaml")
It seems it tries to do something against the non-created-yet cluster.
I've tried adding opts=pulumi.ResourceOptions(depends_on=[cluster])
to it but that doesn't change anything. Any ideas ?flaky-lawyer-21437
07/30/2024, 10:20 AMopts=pulumi.ResourceOptions(provider=k8s_provider)
to it, getting a new error:
error: Program failed with an unhandled exception:
Traceback (most recent call last):
...
Exception: cannot construct components if the provider is configured with unknown values
flaky-lawyer-21437
07/30/2024, 10:27 AMresolution/fixed
, they're still very actual.
Managed to workaround with:
cluster_kubeconfig.apply(lambda _: k8s.yaml.v2.ConfigFile("secator", file="certificate.yaml", opts=pulumi.ResourceOptions(provider=k8s_provider)))
but I don't see my resource in the plan created now..