k0sproject / k0sctl

A bootstrapping and management tool for k0s clusters.
Other
393 stars 77 forks source link

Cannot config calico network on version 0.16.0 #601

Closed nghiepvo-ohmidasvn closed 11 months ago

nghiepvo-ohmidasvn commented 11 months ago

my k0sctl.yaml file:

apiVersion: k0sctl.k0sproject.io/v1beta1
kind: Cluster
metadata:
  name: k0s-cluster
spec:
  hosts:
  - ssh:
      address: 192.168.1.156
      user: root
      port: 22
      keyPath: ~/.ssh/id_rsa_k3s
    role: controller
  - ssh:
      address: 192.168.1.157
      user: root
      port: 22
      keyPath: ~/.ssh/id_rsa_k3s
    role: worker
  - ssh:
      address: 192.168.1.158
      user: root
      port: 22
      keyPath: ~/.ssh/id_rsa_k3s
    role: worker
  k0s:
    version: v1.28.4+k0s.0
    config:
      apiVersion: k0s.k0sproject.io/v1beta1
      kind: ClusterConfig
      metadata:
        name: k0s-cluster
      spec:
        images:
          calico:
            cni:
              image: calico/cni
              version: v3.26.4

after install successful

kubectl -n kube-system get all

NAME                                  READY   STATUS    RESTARTS   AGE
pod/coredns-85df575cdb-6g67q          1/1     Running   0          63s
pod/coredns-85df575cdb-wxm7m          1/1     Running   0          48s
pod/konnectivity-agent-f9kjh          1/1     Running   0          58s
pod/konnectivity-agent-x4564          1/1     Running   0          58s
pod/kube-proxy-fmxg6                  1/1     Running   0          58s
pod/kube-proxy-jnf62                  1/1     Running   0          58s
pod/kube-router-r628c                 1/1     Running   0          58s
pod/kube-router-vkqxs                 1/1     Running   0          58s
pod/metrics-server-7556957bb7-2wdj9   0/1     Running   0          63s

NAME                     TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                  AGE
service/kube-dns         ClusterIP   10.96.0.10       <none>        53/UDP,53/TCP,9153/TCP   74s
service/metrics-server   ClusterIP   10.101.241.121   <none>        443/TCP                  68s

NAME                                DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR            AGE
daemonset.apps/konnectivity-agent   2         2         2       2            2           kubernetes.io/os=linux   75s
daemonset.apps/kube-proxy           2         2         2       2            2           kubernetes.io/os=linux   71s
daemonset.apps/kube-router          2         2         2       2            2           <none>                   77s

NAME                             READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/coredns          2/2     2            2           76s
deployment.apps/metrics-server   0/1     1            0           68s

NAME                                        DESIRED   CURRENT   READY   AGE
replicaset.apps/coredns-85df575cdb          2         2         2       64s
replicaset.apps/metrics-server-7556957bb7   1         1         0       64s

and the calico still has not installed yet.

till commented 11 months ago

You're missing spec.network

nghiepvo-ohmidasvn commented 11 months ago

hi @till I also update


....
  k0s:
    version: v1.28.4+k0s.0
    config:
      apiVersion: k0s.k0sproject.io/v1beta1
      kind: ClusterConfig
      metadata:
        name: k0s-cluster
      spec:
        network:
          images:
            calico:
              cni:
                image: calico/cni
                version: v3.26.4

still not working, could you please help me provide a example that it can work, because I don't see spec.network on document https://github.com/k0sproject/k0sctl

till commented 11 months ago

@nghiepvo-ohmidasvn https://docs.k0sproject.io/v1.20.6+k0s.0/configuration/

nghiepvo-ohmidasvn commented 11 months ago

@till could you make me a example for setup k0s with calico?
I just update with configuration, but it's still not work yet

  k0s:
    version: v1.28.4+k0s.0
    config:
      apiVersion: k0s.k0sproject.io/v1beta1
      kind: ClusterConfig
      metadata:
        name: k0s-cluster
      spec:
        network:
          provider: calico
twz123 commented 11 months ago

Did you recreate your cluster, i.e. did a k0s reset before applying the new config? As per the docs, changing the provider for an already provisioned cluster is not supported:

Note: Once you initialize the cluster with a network provider the only way to change providers is through a full cluster redeployment.

twz123 commented 11 months ago

/cc k0sproject/k0s#3707

nghiepvo-ohmidasvn commented 11 months ago

@twz123 yes, I did, and I also try new some vm for installation, it's not working too

twz123 commented 11 months ago

What behavior do you observe? Can you maybe share the exact steps and their outcome? The config you shared works for me:

$ cat ./k0s.yaml
apiVersion: k0s.k0sproject.io/v1beta1
kind: ClusterConfig
metadata:
  name: k0s-cluster
spec:
  network:
    provider: calico

$ docker run -d --name k0s --hostname k0s --privileged --cgroupns=host -v /sys/fs/cgroup:/sys/fs/cgroup:rw -v /var/lib/k0s -v $(pwd)/k0s.yaml:/etc/k0s/k0s.yaml:ro docker.io/k0sproject/k0s:v1.28.4-k0s.0
Unable to find image 'k0sproject/k0s:v1.28.4-k0s.0' locally
v1.28.4-k0s.0: Pulling from k0sproject/k0s
7264a8db6415: Pull complete
640ab3f7cbbc: Pull complete
9ff41aafc1e8: Pull complete
ddafc87b94d2: Pull complete
Digest: sha256:7c3fe432497827b556f6d8003a63862078971f72ad873c68e7bde8c7c68c3fbb
Status: Downloaded newer image for k0sproject/k0s:v1.28.4-k0s.0
e2ec2875325b1d10c33ab3675cc702e0e27d5937b0407a5d6b68b8c94ec1c7d1

And roughly a minute later:

$ docker exec k0s k0s kc get po -A
NAMESPACE     NAME                                       READY   STATUS    RESTARTS   AGE
kube-system   calico-kube-controllers-84c6cd5b85-b4r6z   1/1     Running   0          59s
kube-system   calico-node-jjnrh                          1/1     Running   0          54s
kube-system   coredns-85df575cdb-kjmkq                   1/1     Running   0          59s
kube-system   konnectivity-agent-f7nsq                   1/1     Running   0          54s
kube-system   kube-proxy-ggksg                           1/1     Running   0          53s
kube-system   metrics-server-7556957bb7-n6fj9            1/1     Running   0          59s
nghiepvo-ohmidasvn commented 11 months ago

thank you so much @twz123, the issue happen cause from template vm, I setup from ISO of linux distribution end to end, it's working fine, I will close issue. Thank @twz123 @till