Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Rancher_APIを使う時に注意したこと

Avatar for Shogo Seki Shogo Seki
September 20, 2019

 Rancher_APIを使う時に注意したこと

Avatar for Shogo Seki

Shogo Seki

September 20, 2019
Tweet

Other Decks in Technology

Transcript

  1. Send curl -X POST ¥ https://localhost/v3/cluster ¥ -H 'Content-Type: application/json'

    ¥ -H 'Authorization: Bearer token-XXXXX:XXXXXXXXXX' ¥ -d '{ "type": "cluster", ... "name": "ABCDEFG" }'
  2. Response { "baseType": "error", "code": "InvalidFormat", "fieldName": "name", "message": "InvalidFormat

    422: invalid value ABCDEFG: a DNS-1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?')", "status": 422, "type": "error" } error!?
  3. Response { "baseType": "error", "code": "InvalidFormat", "fieldName": "name", "message": "InvalidFormat

    422: invalid value ABCDEFG: a DNS-1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?')", "status": 422, "type": "error" } めっちゃ親切やん///
  4. sudo docker run -d --privileged --restart=unless-stopped --net=host -v /etc/kubernetes:/etc/kubernetes -v

    /var/run:/var/run rancher/rancher-agent:latest --server https://localhost --token thmmxq9tjlkjsdfkwmbtsa4bnf2p2lv1l72fazfnt4sdf94ln8fctgg --ca-checksum 29a149e0319ddcc7f8c679d08de07471208bc54186a9e5749bd840befcf742ac --worker
  5. Response { "baseType": "setting", ... "id": "cacerts", ... "value": "-----BEGIN

    CERTIFICATE-----¥n XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX¥n -----END CERTIFICATE-----" }
  6. jq Manual • --raw-output / -r: With this option, if

    the filter’s result is a string then it will be written directly to standard output rather than being formatted as a JSON string with quotes. This can be useful for making jq filters talk to non-JSON-based systems. • --join-output / -j: Like -r but jq won’t print a newline after each output. https://stedolan.github.io/jq/manual/