GAミント至上主義

Web Monomaniacal Developer.

KubernetesでThe edited file had a syntax error: unable to decode "edited-file": [pos 907]: json: expect char '"' but got char '5'

Google Container Engine上のKubernetesで、kubectl edit deploy でyamlをいじっていたら、ポート番号の指定でエラーになった

The edited file had a syntax error: unable to decode "edited-file": [pos 907]: json: expect char '"' but got char '5'


該当箇所は下記

    spec:
      containers:
      - env:
        - name: RABBITMQ_HOST
          value: 10.7.251.6
        - name: RABBITMQ_PORT
          value: 5672

ポート番号はjsでいうとINT型だけど、テキストで使う""で囲わないといけないらしい。
yamlはあんまり触らないので知らないけどそういう仕様なんだろうか。
数字とドットだけどIPはそのままで行ける。

言われたとおりに下記のように、数字を""で囲ったらエラーはなくなった

    spec:
      containers:
      - env:
        - name: RABBITMQ_HOST
          value: 10.7.251.6
        - name: RABBITMQ_PORT
          value: "5672"

Kubernetes: Up and Running; Dive into the Future of Infrastructure

Kubernetes: Up and Running; Dive into the Future of Infrastructure