MusicDin / kubitect

Kubitect provides a simple way to set up a highly available Kubernetes cluster across multiple hosts.
https://kubitect.io
Apache License 2.0
141 stars 35 forks source link

unable to run `kubitect apply --config ./kubitect.yaml --action upgrade` #216

Open bsdlp opened 1 month ago

bsdlp commented 1 month ago
Screenshot 2024-07-17 at 00 01 19

i exported the config for the existing cluster, then tried running kubitect apply --config ./kubitect.yaml --action upgrade - which resulted in an error. i noticed that the git diff added some strange lines so removed them and tried again and still got an error.

the keys that kubitect are complaining about don't exist in the cluster config:

│   cluster.nodes.loadBalancer.instances.1.priority
│   kubernetes.manager

here's my kubitect.yaml file:

jchen@MacBook-Air-4(main|…1)> cat kubitect.yaml                                                                                                          ~/workspace/homelab/kubitect
hosts:
    - name: catnet21390176
      default: true
      connection:
        user: root
        ip: 192.168.51.117
        type: remote
        ssh:
            keyfile: ~/.ssh/id_ed25519
            port: 22
      mainResourcePoolPath: /var/lib/libvirt/images/
      dataResourcePools:
        - name: rook-pool
          path: /var/lib/libvirt/images/
    - name: catnet21390118
      default: false
      connection:
        user: root
        ip: 192.168.51.118
        type: remote
        ssh:
            keyfile: ~/.ssh/id_ed25519
            port: 22
      mainResourcePoolPath: /var/lib/libvirt/images/
      dataResourcePools:
        - name: rook-pool
          path: /var/lib/libvirt/images/
cluster:
    name: pounce
    network:
        cidr: 192.168.0.0/16
        mode: bridge
        bridge: br0
    nodeTemplate:
        user: jchen
        os:
            distro: ubuntu22
            networkInterface: ens3
            source: https://cloud-images.ubuntu.com/releases/jammy/release-20230606/ubuntu-22.04-server-cloudimg-amd64.img
        ssh:
            addToKnownHosts: false
        cpuMode: custom
        dns:
            - 192.168.1.1
        updateOnBoot: true
    nodes:
        master:
            default:
                cpu: 2
                ram: 4
                mainDiskSize: 32
            instances:
                - id: "1"
                  host: catnet21390176
                  cpu: 4
                  ram: 8
                  mainDiskSize: 32
        worker:
            default:
                cpu: 2
                ram: 4
                mainDiskSize: 32
            instances:
                - id: "1"
                  host: catnet21390176
                  cpu: 8
                  ram: 48
                  mainDiskSize: 512
                  dataDisks:
                    - name: rook
                      pool: rook-pool
                      size: 256
                - id: "2"
                  host: catnet21390118
                  cpu: 8
                  ram: 56
                  mainDiskSize: 768
                  dataDisks:
                    - name: rook
                      pool: rook-pool
                      size: 256
        loadBalancer:
            vip: 192.168.200.212
            default:
                cpu: 2
                ram: 4
                mainDiskSize: 32
            instances:
                - id: "1"
                  host: catnet21390118
                  cpu: 4
                  ram: 4
                  mainDiskSize: 16
            forwardPorts:
                - name: http
                  port: 80
                  targetPort: 80
                  target: workers
                - name: https
                  port: 443
                  targetPort: 443
                  target: workers
kubernetes:
    version: v1.26.5
    dnsMode: coredns
    networkPlugin: cilium

kubitect version v3.4.0

any ideas?

MusicDin commented 1 month ago

Thanks for reporting this issue, will look into this and report back. It seems that allowed events for a specific actions need to be tweaked a bit.

MusicDin commented 1 month ago

The kubernetes.manager field should be automatically detected. Can you try adding the following into your configuration?

kubernetes:
  manager: kubespray

Regarding the LB priority, can you share the LB configuration from ~/.kubitect/clusters/pounce/config/kubitect-applied.yaml? Thanks

bsdlp commented 1 month ago

lb section from applied.yaml

        loadBalancer:
            vip: 192.168.200.212
            default:
                cpu: 2
                ram: 4
                mainDiskSize: 32
            instances:
                - id: "1"
                  host: catnet21390118
                  cpu: 4
                  ram: 4
                  mainDiskSize: 16
            forwardPorts:
                - name: http
                  port: 80
                  targetPort: 80
                  target: workers
                - name: https
                  port: 443
                  targetPort: 443
                  target: workers
jchen@MacBook-Air-4(main|✚1…1)> kubitect apply --config ./kubitect.yaml --action upgrade
┌
│ Error type: Invalid Configuration Change
│ Config path:
│   cluster.nodes.loadBalancer.instances.1.priority
│   kubernetes.manager
│ Error:
│   Change is not allowed. Upgrade action allows changing only 'kubernetes.version'.
└
┌
│ Error: Configuration file contains errors.
└
[1] jchen@MacBook-Air-4(main|✚1…1)> git diff
diff --git a/kubitect/kubitect.yaml b/kubitect/kubitect.yaml
index eb3170b..5627edc 100644
--- a/kubitect/kubitect.yaml
+++ b/kubitect/kubitect.yaml
@@ -104,4 +104,5 @@ kubernetes:
     version: v1.26.5
     dnsMode: coredns
     networkPlugin: cilium
+    manager: kubespray