kubectl применить / создать "неожиданный EOF" - PullRequest
0 голосов
/ 06 октября 2018

Мой kubectl не может читать файлы и каждый раз возвращает сообщение об ошибке: неожиданный EOF.

kubectl apply -f service.yaml
> error: unexpected EOF

Я использую очень простой сервис.yaml, как этот, и это происходит с каждым файлом, который я пытаюсьчитать с kubectl:

apiVersion: v1
kind: Service
metadata:
  name: myapp
spec:
  selector:
    app: myapp
  ports:
  - protocol: TCP
    port: 80
    targetPort: 8090
  type: NodePort

Также та же ошибка на kubectl create -f service.yaml и на cat service.yaml | kubectl apply -f -

Удалил + установил / обновил / переустановил его через gcloud:

gcloud version
>Google Cloud SDK 219.0.1
>core 2018.09.28
>docker-credential-gcr 
>gsutil 4.34
>kubectl 2018.09.17

также

kubectl version
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.7", GitCommit:"0c38c362511b20a098d7cd855f1314dad92c2780", GitTreeState:"clean", BuildDate:"2018-08-20T10:09:03Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"9+", GitVersion:"v1.9.7-gke.6", GitCommit:"9b635efce81582e1da13b35a7aa539c0ccb32987", GitTreeState:"clean", BuildDate:"2018-08-16T21:33:47Z", GoVersion:"go1.9.3b4", Compiler:"gc", Platform:"linux/amd64"}

Это может быть не ошибка в kubectl, а на каком-то другом компоненте в моей системе, который kubectl использует для чтения файлов.Но я понятия не имею, где искать.

Система Ubuntu 18.04.1 LTS, все в курсе

ОБНОВЛЕНИЕ: Я снова проверил с опцией -v8отладить

I1013 11:31:43.750810   17705 loader.go:357] Config loaded from file /home/arno/.kube/config
I1013 11:31:43.751750   17705 round_trippers.go:384] GET https://[clusterIP]/openapi/v2
I1013 11:31:43.751766   17705 round_trippers.go:391] Request Headers:
I1013 11:31:43.751772   17705 round_trippers.go:394]     Accept: application/com.github.proto-openapi.spec.v2@v1.0+protobuf
I1013 11:31:43.751778   17705 round_trippers.go:394]     User-Agent: kubectl/v1.10.7 (linux/amd64) kubernetes/0c38c36
I1013 11:31:44.653232   17705 round_trippers.go:409] Response Status: 404 Not Found in 901 milliseconds
I1013 11:31:44.653254   17705 round_trippers.go:412] Response Headers:
I1013 11:31:44.653263   17705 round_trippers.go:415]     Content-Type: application/json
I1013 11:31:44.653270   17705 round_trippers.go:415]     Content-Length: 524
I1013 11:31:44.653285   17705 round_trippers.go:415]     Date: Sat, 13 Oct 2018 09:31:44 GMT
I1013 11:31:44.653291   17705 round_trippers.go:415]     Audit-Id: e765ef72-8c26-4b67-9039-901efc147cba
I1013 11:31:44.654650   17705 request.go:874] Response Body: {
"paths": [
 "/apis",
 "/apis/",
 "/apis/apiextensions.k8s.io",
 "/apis/apiextensions.k8s.io/v1beta1",
 "/healthz",
 "/healthz/etcd",
 "/healthz/ping",
 "/healthz/poststarthook/generic-apiserver-start-informers",
 "/healthz/poststarthook/start-apiextensions-controllers",
 "/healthz/poststarthook/start-apiextensions-informers",
 "/metrics",
 "/swagger-2.0.0.json",
 "/swagger-2.0.0.pb-v1",
 "/swagger-2.0.0.pb-v1.gz",
 "/swagger.json",
 "/swaggerapi",
 "/version"
 ]
}
I1013 11:31:44.663105   17705 round_trippers.go:384] GET https://[clusterIP]/swagger-2.0.0.pb-v1
I1013 11:31:44.663130   17705 round_trippers.go:391] Request Headers:
I1013 11:31:44.663138   17705 round_trippers.go:394]     User-Agent: kubectl/v1.10.7 (linux/amd64) kubernetes/0c38c36
I1013 11:31:44.663144   17705 round_trippers.go:394]     Accept: application/json, */*
I1013 11:31:44.688907   17705 round_trippers.go:409] Response Status: 200 OK in 25 milliseconds
I1013 11:31:44.688928   17705 round_trippers.go:412] Response Headers:
I1013 11:31:44.688935   17705 round_trippers.go:415]     Date: Sat, 13 Oct 2018 09:31:44 GMT
I1013 11:31:44.688942   17705 round_trippers.go:415]     Etag: "629C2395D5FEDD5D2ED46FE7C691E126BE621789A85F507C44292E9B50E3285AEBBA55D242800C3C9B0A9258E64444CE3B55BD8E485788936DAE773C6548EA64"
I1013 11:31:44.688951   17705 round_trippers.go:415]     Last-Modified: Sun, 08 Jul 2018 16:39:40 GMT
I1013 11:31:44.688960   17705 round_trippers.go:415]     Vary: Accept-Encoding
I1013 11:31:44.688969   17705 round_trippers.go:415]     X-From-Cache: 1
I1013 11:31:44.688976   17705 round_trippers.go:415]     Accept-Ranges: bytes
I1013 11:31:44.688983   17705 round_trippers.go:415]     Content-Type: application/octet-stream
I1013 11:31:44.785113   17705 request.go:872] Response Body:
00000000  0a 03 32 2e 30 12 14 0a  0a 4b 75 62 65 72 6e 65  |..2.0....Kuberne|
00000010  74 65 73 12 06 76 31 2e  39 2e 37 42 d4 e0 5f 12  |tes..v1.9.7B.._.|
00000020  ca 02 0a 05 2f 61 70 69  2f 12 c0 02 12 bd 02 0a  |..../api/.......|
00000030  04 63 6f 72 65 1a 1a 67  65 74 20 61 76 61 69 6c  |.core..get avail|
00000040  61 62 6c 65 20 41 50 49  20 76 65 72 73 69 6f 6e  |able API version|
00000050  73 2a 12 67 65 74 43 6f  72 65 41 50 49 56 65 72  |s*.getCoreAPIVer|
00000060  73 69 6f 6e 73 32 10 61  70 70 6c 69 63 61 74 69  |sions2.applicati|
00000070  6f 6e 2f 6a 73 6f 6e 32  10 61 70 70 6c 69 63 61  |on/json2.applica|
00000080  74 69 6f 6e 2f 79 61 6d  6c 32 23 61 70 70 6c 69  |tion/yaml2#appli|
00000090  63 61 74 69 6f 6e 2f 76  6e 64 2e 6b 75 62 65 72  |cation/vnd.kuber|
000000a0  6e 65 74 65 73 2e 70 72  6f 74 6f 62 75 66 3a 10  |netes.protobuf:.|
000000b0  61 70 70 6c 69 63 61 74  69 6f 6e 2f 6a 73 6f 6e  |application/json|
000000c0  3a 10 61 70 70 6c 69 63  61 74 69 6f 6e 2f 79 61  |:.application/y [truncated 10504225 chars]
F1013 11:31:44.806007   17705 helpers.go:119] error: unexpected EOF

1 Ответ

0 голосов
/ 20 октября 2018

Часть с ошибочным ответом указывала на несоответствие версий:

I1013 11:31:43.751750   17705 round_trippers.go:384] GET https://[clusterIP]/openapi/v2
I1013 11:31:43.751766   17705 round_trippers.go:391] Request Headers:
I1013 11:31:43.751772   17705 round_trippers.go:394]     Accept: application/com.github.proto-openapi.spec.v2@v1.0+protobuf
I1013 11:31:43.751778   17705 round_trippers.go:394]     User-Agent: kubectl/v1.10.7 (linux/amd64) kubernetes/0c38c36
I1013 11:31:44.653232   17705 round_trippers.go:409] Response Status: 404 Not Found in 901 milliseconds

Кластер Google kubernetes был в более старой версии, что-то вроде 1.9.x, и мой gcloud kubectl был 1.10.7.После обновления кластера он снова работает.

...