Closed valentinvieriu closed 3 years ago
This by design.
The below ensures that the local-exec provisioning command does not fetch the k3s.yaml until the server is ready and the transform to the external address is complete. The the iptables rule then allows the local-exec to fetch the transformed kubeconfig.
while ! nc -z localhost 6443; do
sleep 1
done
This for my region takes around 10-12 mins. Are you getting a timeout? How long does this take in your region?
I'll give it a try again and report back. I remember was quite long ( 30min maybe ) the wait, so I've expected that something was wrong.
I guess you were right. After 10min worked. It had a hickup with installing the ingress.
But on second run of the terraform apply
worked.
I think it used the previous config in the ~/.kube/k3s
. The IP it tried to connect it's not the current k8s api server.
module.free-tier-k3s.null_resource.kubeconfig: Still creating... [10m10s elapsed]
module.free-tier-k3s.null_resource.kubeconfig: Still creating... [10m20s elapsed]
module.free-tier-k3s.null_resource.kubeconfig (local-exec): Warning: Permanently added '129.159.198.62' (ECDSA) to the list of known hosts.
module.free-tier-k3s.null_resource.kubeconfig: Creation complete after 10m23s [id=7162798813511390964]
module.free-tier-k3s.helm_release.nginx-ingress: Creating...
╷
│ Error: Post "https://132.145.240.93:6443/api/v1/namespaces": dial tcp 132.145.240.93:6443: i/o timeout
│
│ with module.free-tier-k3s.kubernetes_namespace.nginx-ingress,
│ on modules/free-tier-k3s/helm.tf line 2, in resource "kubernetes_namespace" "nginx-ingress":
│ 2: resource "kubernetes_namespace" "nginx-ingress" {
│
╵
╷
│ Error: create: failed to create: namespaces "nginx-ingress" not found
│
│ with module.free-tier-k3s.helm_release.nginx-ingress,
│ on modules/free-tier-k3s/helm.tf line 8, in resource "helm_release" "nginx-ingress":
│ 8: resource "helm_release" "nginx-ingress" {
│
Jus happened to me couple of times that the cloud intit scrip
modules/free-tier-k3s/scripts/server.template.sh
was just partially executed. I've had to ssh and manually run the remaining code:This locks the installation process
Here is the
sudo cat /var/log/cloud-init-output.log