polyrabbit / etcdfs

:file_folder: Mount etcd into a local directory
MIT License
82 stars 7 forks source link
etcd etcd-client filesystem fuse

etcdfs - A FUSE filesystem backed by etcd

Tests License: MIT PRs Welcome Go Report Card

中文简介

Tired of typing etcdctl? why not mount it to local filesystem and open in your favorite editors?

Example

Wondering how Kubernetes organizes data in etcd? After mounting it locally, we can use VS Code to get the whole picture:

etcd-of-a-kubernetes

Hint: steps to mount Kubernetes etcd locally:

$ # scp etcd certificates to a local directory (keep them carefully)
$ scp -r <kubernetes-master-ip>:/etc/kubernetes/pki/etcd .
$ # mount to a local directory
$ etcdfs --endpoints=<kubernetes-master-ip>:2379 --cacert etcd/ca.crt --key etcd/server.key --cert etcd/server.crt mnt
$ # open it in VS code
$ code mnt

Installation

Homebrew

# WIP

curl | bash style downloads to /usr/local/bin

$ curl -sfL https://raw.githubusercontent.com/polyrabbit/etcdfs/master/.godownloader.sh | bash -s -- -d -b /usr/local/bin

Using Go

$ go get -u github.com/polyrabbit/etcdfs

Usage

$ etcdfs
Mount etcd to local file system - find help/update from https://github.com/polyrabbit/etcdfs

Usage:
  etcdfs [mount-point] [flags]

Flags:
      --endpoints strings       etcd endpoints (default [127.0.0.1:2379])
      --dial-timeout duration   dial timeout for client connections (default 2s)
      --read-timeout duration   timeout for reading and writing to etcd (default 3s)
  -v, --verbose                 verbose output
      --enable-pprof            enable runtime profiling data via HTTP server. Address is at "http://localhost:9327/debug/pprof"
      --cert string             identify secure client using this TLS certificate file
      --key string              identify secure client using this TLS key file
      --cacert string           verify certificates of TLS-enabled secure servers using this CA bundle
      --mount-options strings   options are passed as -o string to fusermount (default [nonempty])
  -h, --help                    help for etcdfs

Notice: etcdfs has a very similar CLI syntax to etcdctl.

Limitations

Supported Operations

Most commonly used POSIX operations are supported:

TODO

Credits

License

The MIT License (MIT) - see LICENSE.md for more details