flannel-io / flannel

flannel is a network fabric for containers, designed for Kubernetes
Apache License 2.0
8.61k stars 2.87k forks source link

kubectl apply -f kube-flannel.yml failed #1840

Closed evdremin closed 6 months ago

evdremin commented 6 months ago

I've installed Kubernetes version 1.28.2 and trying to configure flannel in offline environment. I've downloaded kube-flannel.yml using the link https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

When I'm trying to apply it the following happens:

sudo kubectl create -f kube-flannel.yml -v=8
I1214 16:11:09.529241   49882 round_trippers.go:463] GET http://localhost:8080/openapi/v2?timeout=32s
I1214 16:11:09.529297   49882 round_trippers.go:469] Request Headers:
I1214 16:11:09.529308   49882 round_trippers.go:473]     Accept: application/com.github.proto-openapi.spec.v2@v1.0+protobuf
I1214 16:11:09.529317   49882 round_trippers.go:473]     User-Agent: kubectl/v1.28.2 (linux/amd64) kubernetes/89a4ea3
I1214 16:11:09.531709   49882 round_trippers.go:574] Response Status: 404 Not Found in 2 milliseconds
I1214 16:11:09.531738   49882 round_trippers.go:577] Response Headers:
I1214 16:11:09.531748   49882 round_trippers.go:580]     Cache-Control: must-revalidate,no-cache,no-store
I1214 16:11:09.531758   49882 round_trippers.go:580]     Content-Length: 0
I1214 16:11:09.531839   49882 request.go:1212] Response Body:
I1214 16:11:09.532004   49882 round_trippers.go:463] GET http://localhost:8080/swagger-2.0.0.pb-v1?timeout=32s
I1214 16:11:09.532010   49882 round_trippers.go:469] Request Headers:
I1214 16:11:09.532023   49882 round_trippers.go:473]     Accept: application/json, */*
I1214 16:11:09.532032   49882 round_trippers.go:473]     User-Agent: kubectl/v1.28.2 (linux/amd64) kubernetes/89a4ea3
I1214 16:11:09.532961   49882 round_trippers.go:574] Response Status: 404 Not Found in 0 milliseconds
I1214 16:11:09.532976   49882 round_trippers.go:577] Response Headers:
I1214 16:11:09.532984   49882 round_trippers.go:580]     Content-Length: 71
I1214 16:11:09.532992   49882 round_trippers.go:580]     Cache-Control: must-revalidate,no-cache,no-store
I1214 16:11:09.532998   49882 round_trippers.go:580]     Content-Type: application/json
I1214 16:11:09.533029   49882 request.go:1212] Response Body: {
"message":"Not Found",
"url":"/swagger-2.0.0.pb-v1",
"status":"404"
}
I1214 16:11:09.533209   49882 helpers.go:246] server response object: [{
  "metadata": {},
  "status": "Failure",
  "message": "the server could not find the requested resource",
  "reason": "NotFound",
  "details": {
    "causes": [
      {
        "reason": "UnexpectedServerResponse",
        "message": "unknown"
      }
    ]
  },
  "code": 404
}]
Error from server (NotFound): the server could not find the requested resource

Expected Behavior

Current Behavior

Possible Solution

I guess the reason is maybe Kubernetes version 1.28 + does not support the "/swagger-2.0.0.pb-v1" endpoint anymore (https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.29.md#changelog-since-v1280-1). Is there any workarounds?

Steps to Reproduce (for bugs)

1. 2. 3. 4.

Context

Your Environment

thomasferrandiz commented 6 months ago

Hi I just tried with k8s 1.28.2 and I didn't have any issue.

 # kubectl create  -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml -v 8
I1214 17:02:29.867845    1131 loader.go:395] Config loaded from file:  /etc/kubernetes/admin.conf
I1214 17:02:29.868700    1131 round_trippers.go:463] GET https://*:6443/openapi/v2?timeout=32s
I1214 17:02:29.868719    1131 round_trippers.go:469] Request Headers:
I1214 17:02:29.868731    1131 round_trippers.go:473]     Accept: application/com.github.proto-openapi.spec.v2@v1.0+protobuf
I1214 17:02:29.868742    1131 round_trippers.go:473]     User-Agent: kubectl/v1.28.2 (linux/amd64) kubernetes/89a4ea3
I1214 17:02:29.896091    1131 round_trippers.go:574] Response Status: 200 OK in 27 milliseconds
I1214 17:02:29.896115    1131 round_trippers.go:577] Response Headers:
I1214 17:02:29.896126    1131 round_trippers.go:580]     Vary: Accept-Encoding
I1214 17:02:29.896137    1131 round_trippers.go:580]     Vary: Accept
I1214 17:02:29.896147    1131 round_trippers.go:580]     X-Kubernetes-Pf-Prioritylevel-Uid: 06f809d8-0066-4b6c-a92f-2916310fc9be
I1214 17:02:29.896157    1131 round_trippers.go:580]     X-Varied-Accept: application/com.github.proto-openapi.spec.v2@v1.0+protobuf
I1214 17:02:29.896167    1131 round_trippers.go:580]     Accept-Ranges: bytes
I1214 17:02:29.896176    1131 round_trippers.go:580]     Audit-Id: d2ae99b5-3477-4a5f-a502-15e55b97e868
I1214 17:02:29.896186    1131 round_trippers.go:580]     Cache-Control: no-cache, private
I1214 17:02:29.896195    1131 round_trippers.go:580]     Content-Type: application/com.github.proto-openapi.spec.v2.v1.0+protobuf
I1214 17:02:29.896205    1131 round_trippers.go:580]     Etag: "904299441404D9B9C56AE74124E323D191186D8568EE246C04F231DFA98E63F89A80EDECBF25715C17D5E1FADAFFD2E78394CB0A12CAE5589074247F84AB334E"
I1214 17:02:29.896215    1131 round_trippers.go:580]     X-From-Cache: 1
I1214 17:02:29.896224    1131 round_trippers.go:580]     Date: Thu, 14 Dec 2023 17:02:29 GMT
I1214 17:02:29.896231    1131 round_trippers.go:580]     Last-Modified: Thu, 14 Dec 2023 17:02:22 GMT
I1214 17:02:29.896240    1131 round_trippers.go:580]     X-Kubernetes-Pf-Flowschema-Uid: fa954be0-a67e-45dd-b4aa-15f350322d94
I1214 17:02:29.956991    1131 request.go:1210] Response Body:

My requests go to port 6443 and not 8080 however. Maybe there is an issue in your kubeconfig file?

evdremin commented 6 months ago

thanks a lot! The reason was in the missed ~/.kube/config file. Even though KUBECONFIG environment has been specified properly with correct config file - it was somehow ignored.