Skip to content

Instantly share code, notes, and snippets.

@danehans
Created January 31, 2017 22:10
Show Gist options
  • Select an option

  • Save danehans/63826c5f8faa8c5f62e2cb21176dfb82 to your computer and use it in GitHub Desktop.

Select an option

Save danehans/63826c5f8faa8c5f62e2cb21176dfb82 to your computer and use it in GitHub Desktop.
etcd_curl_commands
# etcd clustering:
https://coreos.com/os/docs/latest/cluster-discovery.html
# Getting the etcd version. The etcd version of a specific instance can be obtained from the /version endpoint.
curl -L http://127.0.0.1:4001/version
# Starting etcd manually with add’l flags:
./etcd --name 10.0.0.5 \
--data-dir /var/lib/etcd/default.etcd \
--listen-peer-urls http://10.0.0.5:2380 \
--listen-client-urls http://0.0.0.0:2379 \
--advertise-client-urls http://10.0.0.5:2379 \
--initial-advertise-peer-urls http://10.0.0.5:2380 \
--discovery https://discovery.etcd.io/4347f6e00843310e7e6529d9ab80f400
Kube Commands
# Test PUTing data
curl -L http://127.0.0.1:2379/v2/keys/mykey -XPUT -d value="this is awesome"
curl -L http://127.0.0.1:2379/v2/keys/mykey
# Ask etcd server if gist-reveal service is consistent?
curl -i http://10.10.10.2:4001/v2/keys/registry/services/endpoints/gist-reveal?consistent=true&recursive=false&sorted=true
# Ask etcd server if 10.10.10.5 is a registered host
curl -i http://10.10.10.2:4001/v2/keys/registry/hosts/10.10.10.5/
# Magnum web.service example
# Note: updated etc port number
# curl -i http://127.0.0.1:2379/v2/keys/registry/services/specs/default/web
HTTP/1.1 200 OK
Content-Type: application/json
X-Etcd-Cluster-Id: bdbc94c53e6707fe
X-Etcd-Index: 2221
X-Raft-Index: 46009
X-Raft-Term: 2
Date: Sat, 29 Aug 2015 03:33:16 GMT
Content-Length: 523
{"action":"get","node":{"key":"/registry/services/specs/default/web","value":"{\"kind\":\"Service\",\"apiVersion\":\"v1beta3\",\"metadata\":{\"name\":\"web\",\"namespace\":\"default\",\"uid\":\"c3c38c2a-4dcd-11e5-8fc4-fa163e8ecfa1\",\"creationTimestamp\":\"2015-08-28T21:43:05Z\"},\"spec\":{\"ports\":[{\"name\":\"\",\"protocol\":\"TCP\",\"port\":8000,\"targetPort\":80}],\"selector\":{\"name\":\"web\"},\"portalIP\":\"10.254.147.190\",\"sessionAffinity\":\"None\"},\"status\":{}}","modifiedIndex":117,"createdIndex":117}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment