Giter VIP home page Giter VIP logo

kubernaut's Introduction

Kubernaut

Build Status

Ephemeral Kubernetes clusters for frustration and friction free development. This is the kubernaut CLI.

Installation

An executable binary is provided for both Linux and MacOS. There is no Windows support at this time.

Native Installation

Latest release: curl http://releases.datawire.io/kubernaut/latest.txt

Linux

curl -OL http://releases.datawire.io/kubernaut/$(curl http://releases.datawire.io/kubernaut/latest.txt)/linux/amd64/kubernaut

macOS

curl -OL http://releases.datawire.io/kubernaut/$(curl http://releases.datawire.io/kubernaut/latest.txt)/darwin/amd64/kubernaut

Quick Start

Get Token

NOTE: This is temporary until we have a better account mgmt and login UX.

  1. Goto https://kubernaut.io/token and login.
  2. Copy the token to your clipboard.
  3. Run the below command:

kubernaut config backend create --url="https://next.kubernaut.io" --name="v2" --activate $TOKEN

Create a cluster claim

kubernaut claims create --name mycluster

View active Claims

kubernaut claims list

Delete a cluster claim

kubernaut claims delete mycluster

Developer Information

Versioning

The kubernaut command line application uses Calendar Versioning ("CalVer") for releases.

  • The version scheme is ${YYYY}.${MM}.${DD}[-${GIT_COMMIT}].
  • Latest releases always have the ${GIT_COMMIT} appended after a dash.
  • Latest releases are any build from master branch that passes CI tests.
  • FUTURE - Stable release cadence has not been determined but WILL HAVE the form ${YYYY}.${MM}.${DD} without the ${GIT_COMMIT} appended.

kubernaut's People

Contributors

gitter-badger avatar plombardi89 avatar rhs avatar richarddli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kubernaut's Issues

no register command and other stuff...

I tried the quickstart again with python3 and got much farther. ;-)

Still ran into trouble (no register command, claim asked me to login, login just prints the username/password I had to make up, and then claim didn't seem to work).

I've included the transcript below:

Usage: kubernaut [OPTIONS] COMMAND [ARGS]...

  kubernaut: easy kubernetes clusters for painless development and testing

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  claim       claim your Kubernetes cluster
  kubeconfig  retrieve clusters kubeconfig
  login       login to access the kubernaut.io service
  release     release your Kubernetes cluster
(kubernaut) [rhs@venture ~]$ kubernaut claim
(kubernaut) [rhs@venture ~]$ kubernaut claim
Credentials not found for kubernaut.io. Please login first with `kubernaut login`.
(kubernaut) [rhs@venture ~]$ kubernaut login
Username: rhs
Password: 
{'credentials': {'kubernaut.io': {'password': 'asdf', 'username': 'rhs'}}}
(kubernaut) [rhs@venture ~]$ kubernaut register
Usage: kubernaut [OPTIONS] COMMAND [ARGS]...

Error: No such command "register".
(kubernaut) [rhs@venture ~]$ kubernaut 
Usage: kubernaut [OPTIONS] COMMAND [ARGS]...

  kubernaut: easy kubernetes clusters for painless development and testing

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  claim       claim your Kubernetes cluster
  kubeconfig  retrieve clusters kubeconfig
  login       login to access the kubernaut.io service
  release     release your Kubernetes cluster
(kubernaut) [rhs@venture ~]$ kubernaut claim
Traceback (most recent call last):
  File "/home/rhs/.virtualenvs/kubernaut/lib/python3.5/site-packages/urllib3/connection.py", line 141, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/home/rhs/.virtualenvs/kubernaut/lib/python3.5/site-packages/urllib3/util/connection.py", line 60, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/lib64/python3.5/socket.py", line 733, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/rhs/.virtualenvs/kubernaut/lib/python3.5/site-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/home/rhs/.virtualenvs/kubernaut/lib/python3.5/site-packages/urllib3/connectionpool.py", line 357, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib64/python3.5/http/client.py", line 1107, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib64/python3.5/http/client.py", line 1152, in _send_request
    self.endheaders(body)
  File "/usr/lib64/python3.5/http/client.py", line 1103, in endheaders
    self._send_output(message_body)
  File "/usr/lib64/python3.5/http/client.py", line 934, in _send_output
    self.send(msg)
  File "/usr/lib64/python3.5/http/client.py", line 877, in send
    self.connect()
  File "/home/rhs/.virtualenvs/kubernaut/lib/python3.5/site-packages/urllib3/connection.py", line 166, in connect
    conn = self._new_conn()
  File "/home/rhs/.virtualenvs/kubernaut/lib/python3.5/site-packages/urllib3/connection.py", line 150, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7ff2a5cc1048>: Failed to establish a new connection: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/rhs/.virtualenvs/kubernaut/lib/python3.5/site-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/home/rhs/.virtualenvs/kubernaut/lib/python3.5/site-packages/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/home/rhs/.virtualenvs/kubernaut/lib/python3.5/site-packages/urllib3/util/retry.py", line 388, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='kubernaut.io', port=80): Max retries exceeded with url: /cluster (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7ff2a5cc1048>: Failed to establish a new connection: [Errno -2] Name or service not known',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/rhs/.virtualenvs/kubernaut/bin/kubernaut", line 11, in <module>
    load_entry_point('kubernaut==0.1.0', 'console_scripts', 'kubernaut')()
  File "/home/rhs/.virtualenvs/kubernaut/lib/python3.5/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/rhs/.virtualenvs/kubernaut/lib/python3.5/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/rhs/.virtualenvs/kubernaut/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/rhs/.virtualenvs/kubernaut/lib/python3.5/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/rhs/.virtualenvs/kubernaut/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/rhs/.virtualenvs/kubernaut/lib/python3.5/site-packages/kubernaut/cli.py", line 46, in wrapper
    return func(*args, **kwargs)
  File "/home/rhs/.virtualenvs/kubernaut/lib/python3.5/site-packages/kubernaut/cli.py", line 62, in cli_claim
    resp = requests.post(url, auth=auth)
  File "/home/rhs/.virtualenvs/kubernaut/lib/python3.5/site-packages/requests/api.py", line 112, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/home/rhs/.virtualenvs/kubernaut/lib/python3.5/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/rhs/.virtualenvs/kubernaut/lib/python3.5/site-packages/requests/sessions.py", line 502, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/rhs/.virtualenvs/kubernaut/lib/python3.5/site-packages/requests/sessions.py", line 612, in send
    r = adapter.send(request, **kwargs)
  File "/home/rhs/.virtualenvs/kubernaut/lib/python3.5/site-packages/requests/adapters.py", line 504, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='kubernaut.io', port=80): Max retries exceeded with url: /cluster (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7ff2a5cc1048>: Failed to establish a new connection: [Errno -2] Name or service not known',))

try to follow the manual. this is what i got

โฑ kubernaut config backend create --url="https://next.kubernaut.io" --name="v2" --activate $TOKEN
Traceback (most recent call last):
File "kubernaut/cli.py", line 47, in
File "site-packages/click/core.py", line 764, in call
File "site-packages/click/core.py", line 717, in main
File "site-packages/click/core.py", line 1134, in invoke
File "site-packages/click/core.py", line 956, in invoke
File "site-packages/click/core.py", line 555, in invoke
File "site-packages/click/decorators.py", line 17, in new_func
File "kubernaut/cli.py", line 32, in cli
File "kubernaut/config/model.py", line 72, in load
File "pathlib.py", line 1189, in read_text
File "pathlib.py", line 1176, in open
IsADirectoryError: [Errno 21] Is a directory: '/Users/anatoly/Library/Application Support/kubernaut/config'
[16789] Failed to execute script cli

kubernaut 0.1.40 can't set-token with Python 3

Traceback (most recent call last):
  File "/Users/flynn/datawire/a2/end-to-end/kubernaut/.bootstrap/_pex/pex.py", line 365, in execute
  File "/Users/flynn/datawire/a2/end-to-end/kubernaut/.bootstrap/_pex/pex.py", line 293, in _wrap_coverage
  File "/Users/flynn/datawire/a2/end-to-end/kubernaut/.bootstrap/_pex/pex.py", line 325, in _wrap_profiling
  File "/Users/flynn/datawire/a2/end-to-end/kubernaut/.bootstrap/_pex/pex.py", line 408, in _execute
  File "/Users/flynn/datawire/a2/end-to-end/kubernaut/.bootstrap/_pex/pex.py", line 466, in execute_entry
  File "/Users/flynn/datawire/a2/end-to-end/kubernaut/.bootstrap/_pex/pex.py", line 484, in execute_pkg_resources
  File "/Users/flynn/.pex/install/click-6.7-py2.py3-none-any.whl.6d9ff910081ac14222b6215822bc2664662de745/click-6.7-py2.py3-none-any.whl/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Users/flynn/.pex/install/click-6.7-py2.py3-none-any.whl.6d9ff910081ac14222b6215822bc2664662de745/click-6.7-py2.py3-none-any.whl/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Users/flynn/.pex/install/click-6.7-py2.py3-none-any.whl.6d9ff910081ac14222b6215822bc2664662de745/click-6.7-py2.py3-none-any.whl/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/flynn/.pex/install/click-6.7-py2.py3-none-any.whl.6d9ff910081ac14222b6215822bc2664662de745/click-6.7-py2.py3-none-any.whl/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/flynn/.pex/install/click-6.7-py2.py3-none-any.whl.6d9ff910081ac14222b6215822bc2664662de745/click-6.7-py2.py3-none-any.whl/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Users/flynn/.pex/install/kubernaut-0.1.40-py3-none-any.whl.dec8a4facc843eaf3ac6b5906a6d908ba8d1c452/kubernaut-0.1.40-py3-none-any.whl/kubernaut/cli.py", line 137, in wrapper
    return func(*args, **kwargs)
  File "/Users/flynn/.pex/install/kubernaut-0.1.40-py3-none-any.whl.dec8a4facc843eaf3ac6b5906a6d908ba8d1c452/kubernaut-0.1.40-py3-none-any.whl/kubernaut/cli.py", line 221, in cli_set_token
    save_config(config)
  File "/Users/flynn/.pex/install/kubernaut-0.1.40-py3-none-any.whl.dec8a4facc843eaf3ac6b5906a6d908ba8d1c452/kubernaut-0.1.40-py3-none-any.whl/kubernaut/cli.py", line 99, in save_config
    json.dump(config_data, cf, indent=2)
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/__init__.py", line 180, in dump
    fp.write(chunk)
TypeError: a bytes-like object is required, not 'str'

Missing a .encode('utf-8') somewhere, maybe? Kubernaut 0.1.39 seems OK here.

lifecycle management scenarios

  • ability to specify up front that a claim should automatically expire after a specified time would be handy for CI
  • ability to "group" claims somehow and delete the whole group

Improve Kubernaut development loop

Kubernaut is rather painful to develop on, not because it is a complex technical project, but because there are several moving parts that need to be developed.

  1. The API server and claims broker
  2. The Kubernaut VM image (dev loop is painful because need to setup ad-hoc cloud resources to hack on it)
  3. The Kubernautlet (aka "kubernaut-agent") which registers and heartbeats the availability of a cluster to the broker.
  4. Various "cloud" specific things (e.g. VPC management, autoscaling group management). They're not intuitive or exposed in a dev-friendly way.
  5. The Kubernaut CLI
  6. The fronting API gateway and authentication system.

This is a bit of a planning / goal setting epic. But we should look into why extending Kubernaut is difficult. I suspect it's some of the following:

  1. Poor architectural and operational docs.
  2. The broker is written in Kotlin rather than Python or Go.
  3. Dev environment setup is difficult.
  4. We lack a good separation between "live" and "staging" environments.

Any other issues folks can think of that come to mind?

Support `kubernaut env` to emit useful environment variables

Make it easy to set up access to the Kubernaut facilities made available by the current claim. Something like

$ kubernaut env
KUBECONFIG=/Users/ark3/.kube/kubernaut
KUBERNAUT_IP=18.72.0.100
$ eval $(kubernaut env)

Future Kubernaut features could add to that list of variables, e.g.,

KUBERNAUT_DOCKER_REGISTRY=18.72.0.101

It might be useful to support other shells (kubernaut env --shell=fish). Presumably once multiple claims are a thing, this subcommand would need a --name flag as well.

Kubernaut Administrative Control Endpoint

A way to communicate with the Kubernetes cluster before instance termination so we can initiate shutdown and cleanup of user created load balancers or volumes.

When a claim is released we would send an instruction to the agent which in turn would perform operations on the Kubernetes master that cleanup cloud resources. This could be implemented in a number of ways, but as an HTTP endpoint or SSH sent command are the two most likely.

Command `kubernaut claims create` without parameters raises traceback

User ran into this error today:

(poc) [rhs@venture poc]$ kubernaut claims create 

Traceback (most recent call last):
  File "kubernaut/cli.py", line 47, in <module>
  File "site-packages/click/core.py", line 722, in __call__
  File "site-packages/click/core.py", line 697, in main
  File "site-packages/click/core.py", line 1066, in invoke
  File "site-packages/click/core.py", line 1066, in invoke
  File "site-packages/click/core.py", line 895, in invoke
  File "site-packages/click/core.py", line 535, in invoke
  File "site-packages/click/decorators.py", line 27, in new_func
  File "kubernaut/claims/cmd.py", line 62, in create_claim
  File "kubernaut/claims/cmd.py", line 146, in create_final_spec
  File "kubernaut/util.py", line 48, in random_name
  File "kubernaut/util.py", line 39, in load_resource
  File "site-packages/pkg_resources/__init__.py", line 1238, in resource_string
  File "site-packages/pkg_resources/__init__.py", line 1482, in get_resource_string
  File "site-packages/pkg_resources/__init__.py", line 1558, in _get
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 479, in get_data
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/_MEIgLujsB/kubernaut/resources/names.json'

[25303] Failed to execute script cli

Almost certainly caused by the fact the data files are not packaged into the binary. This should be a relatively straightforward fix.

stuff to use kubernaut for demo

  1. ability to control the lifespan of the cluster (hard limit of 1 hour no good for demo)
  2. ability to have multiple clusters (I don't want my long lived cluster to prevent me from getting shorter lived ones)
  3. some way to specify a stable dns name for my cluster when I claim it (we put this in slides prior to demo so audience can participate)
  4. LoadBalancer support
  5. Multiple nodes (more capacity)

[RFE] Add a --quiet flag

Whenever you call kubernaut claims create it spits out a big usage message:

$ ./kubernaut claims create --name "$(cat mycluster.knaut.claim)" --cluster-group main

 Your clusters kubeconfig has been written to the below path:
 
 /home/lukeshu/.kube/mycluster-lukeshu-1fe24e81-5104-476c-8983-288b4594da26.yaml
 
 Usage Instructions:

 There are several ways you can use this kubeconfig file:

 1. Pass --kubeconfig to the `kubectl` command:

    kubectl --kubeconfig=/home/lukeshu/.kube/mycluster-lukeshu-1fe24e81-5104-476c-8983-288b4594da26.yaml ...

 2. Set the KUBECONFIG environment variable:

    export KUBECONFIG=/home/lukeshu/.kube/mycluster-lukeshu-1fe24e81-5104-476c-8983-288b4594da26.yaml
    

This is surely helpful for interactive use. However, when calling it from another program/script, this is just noise that the user would have to ignore. I'm hesitant to just say >/dev/null because if there is diagnostic output, I don't want to hide it.

I think that it would be a good UI improvement to either

  • add a -q/--quiet flag to silence that message, or
  • promise that all diagnostic output would go on stderr (and not stdout). This might already be the case (I'm not sure); if it is, that fact should be documented.

Support creating multiple claims

A user wants to be able to claim multiple clusters from the Kubernaut CLI or Kubernaut API.

From the CLI this should be doable with the existing kubernaut claim command. The command should be enhanced with a --name flag that supports a textual name.

From the API this should be exposed via an incoming HTTP request using a JSON body that acts as configuration for the service.

Ambassador external routing doesn't work in Kubernaut

I create an Ambassador service of type NodePort, and add the following mapping:

---
apiVersion: v1
kind: Service
metadata:
  name: httpbin
  annotations:
    getambassador.io/config: |
      ---
      apiVersion: ambassador/v0
      kind:  Mapping
      name:  httpbin
      prefix: /httpbin/
      service: httpbin.org:80
      host_rewrite: httpbin.org
spec:
  type: ClusterIP
  clusterIP: None

I get the following:

lost-cause:tmp richard$ curl -v 35.170.63.56:31232/httpbin/ip/
*   Trying 35.170.63.56...
* TCP_NODELAY set
* Connected to 35.170.63.56 (35.170.63.56) port 31232 (#0)
> GET /httpbin/ip/ HTTP/1.1
> Host: 35.170.63.56:31232
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 503 Service Unavailable
< content-length: 19
< content-type: text/plain
< date: Thu, 15 Feb 2018 19:24:51 GMT
< server: envoy
<
* Connection #0 to host 35.170.63.56 left intact

The mapping does show up correctly in Ambassador diagnostics. When I use the exact same config on GKE, it works correctly.

Support LoadBalancer Services

Kubernaut currently does not support LoadBalancer services but many people use type: LoadBalancer in their service manifests. The current work around is to use type: NodePort but this means changing manifests specifically for Kubernaut which is undesirable.

Traceback when `claims delete <name>` is invoked and there is no backend defined.

[5667] Failed to execute script cli
Traceback (most recent call last):
  File "kubernaut/cli.py", line 47, in <module>
  File "site-packages/click/core.py", line 722, in __call__
  File "site-packages/click/core.py", line 697, in main
  File "site-packages/click/core.py", line 1066, in invoke
  File "site-packages/click/core.py", line 1066, in invoke
  File "site-packages/click/core.py", line 895, in invoke
  File "site-packages/click/core.py", line 535, in invoke
  File "site-packages/click/decorators.py", line 27, in new_func
  File "kubernaut/claims/cmd.py", line 120, in delete_claim
AttributeError: 'NoneType' object has no attribute 'delete_claim'
make: *** [cluster.yaml] Error 255```

Support a minikube-style `kubernaut service <service_name>`

Make it easy to get the hostname/IP and port needed to reach a service running in a Kubernaut cluster. Something like

$ kubernaut service hello-world
http://i-10v3-ku83rn4u7.kubernaut.io:31797

It's not as good as really supporting LoadBalancer services, but it can help.

Config directory needs to be created if it doesn't exist

The first time I tried to migrate from Kubernaut v1 to v2 I got this:

kubernaut config backend create --url="https://next.kubernaut.io" --name="v2" --activate $token
Traceback (most recent call last):
  File "kubernaut/cli.py", line 47, in <module>
  File "site-packages/click/core.py", line 722, in __call__
  File "site-packages/click/core.py", line 697, in main
  File "site-packages/click/core.py", line 1066, in invoke
  File "site-packages/click/core.py", line 1066, in invoke
  File "site-packages/click/core.py", line 1066, in invoke
  File "site-packages/click/core.py", line 895, in invoke
  File "site-packages/click/core.py", line 535, in invoke
  File "site-packages/click/decorators.py", line 27, in new_func
  File "kubernaut/config/cmd.py", line 49, in create_backend
  File "kubernaut/config/model.py", line 67, in save
  File "pathlib.py", line 1213, in write_text
  File "pathlib.py", line 1181, in open
  File "pathlib.py", line 1035, in _opener
  File "pathlib.py", line 387, in wrapped
FileNotFoundError: [Errno 2] No such file or directory: '/Users/flynn/Library/Application Support/kubernaut/config'
[63733] Failed to execute script cli

Running mkdir '/Users/flynn/Library/Application Support/kubernaut/config' solved the problem.

As an aside: should we just standardize on $HOME/.config/kubernaut like V1 did, and not use click.get_app_dir()? Aside from the fact that it feels a bit odd to me that Kubernaut is using stuff in Library/Application Support since isn't a very Mac-y application, it seems that telling everyone a single config path rather than having it be platform-specific might be convenient.

Curlable Kubernaut API

Kubernaut curl API:

Claim a cluster:
 GET <URL>/claims/<client-supplied-globally-scoped-claim-name>?expires=<deadline> -> kubeconfig file

Renew a claim:
 GET <URL>/claims/<client-supplied-globally-scoped-claim-name>?expires=<new-later-deadline> -> kubeconfig file

Release a cluster
 GET <URL>/claims/<client-supplied-globally-scoped-claim-name>?expires=<time-in-past> -> kubeconfig file

List claims:
 GET <URL>/claims/ -> json body with list of globally-scoped-claim-names

Rationale:

After having integrated kubernaut into a bunch of dev loops, I think
the above curl-based API would probably be simpler/easier to work
with and would avoid a bunch of the work associated with having a
fat client.

FWIW, the list part isn't actually directly needed by the
integrations, but it is useful for debugging/correcting resource
leaks.

Kubernaut does not always set the exit status when it fails

$ ~/datawire/kubernaut/virtualenv/bin/kubernaut --version
kubernaut v0.1.25
$ ~/datawire/kubernaut/virtualenv/bin/kubernaut claim
You attempted to `kubernaut claim` a cluster but you are already at your maximum claim limit (1). Please release your existing claim `kubernaut discard` or wait until the existing claim expires.
$ echo $?
0
$ # WTF

Persistent storage doesn't work

I tried to deploy a mongoDB. kubectl describe pod mongodb says:

` FirstSeen LastSeen Count From SubObjectPath Type Reason Message


5m 29s 22 {default-scheduler } Warning FailedScheduling PersistentVolumeClaim is not bound: "todo-db-persistent-storage-todo-db-0"`

kubernaut client doesn't seem to work on circleci macos

chmod +x ./kubernaut
./kubernaut claims delete cluster-distiller-1A7B0AA4-65E3-4717-90C2-E9EA1B8BC5B4
[1707] Error loading Python lib '/var/folders/ms/xg67k5sn16xc7sdr_w3q45840000gn/T/_MEIyD8FYn/.Python': dlopen: dlopen(/var/folders/ms/xg67k5sn16xc7sdr_w3q45840000gn/T/_MEIyD8FYn/.Python, 10): Symbol not found: _futimens
Referenced from: /var/folders/ms/xg67k5sn16xc7sdr_w3q45840000gn/T/_MEIyD8FYn/.Python (which was built for Mac OS X 10.13)
Expected in: /usr/lib/libSystem.B.dylib
in /var/folders/ms/xg67k5sn16xc7sdr_w3q45840000gn/T/_MEIyD8FYn/.Python
make: *** [cluster.knaut] Error 255
Exited with code 2

`kubernaut set-token` fails with a traceback

I pip install kubernaut'ed (on Python 2.7; Ubuntu). When I got to the set-token step:

Traceback (most recent call last):
  File "/home/exarkun/Environments/everything/bin/kubernaut", line 11, in <module>
    sys.exit(cli())
  File "/home/exarkun/Environments/everything/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/exarkun/Environments/everything/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/exarkun/Environments/everything/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/exarkun/Environments/everything/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/exarkun/Environments/everything/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/exarkun/Environments/everything/local/lib/python2.7/site-packages/kubernaut/cli.py", line 137, in wrapper
    return func(*args, **kwargs)
  File "/home/exarkun/Environments/everything/local/lib/python2.7/site-packages/kubernaut/cli.py", line 221, in cli_set_token
    save_config(config)
  File "/home/exarkun/Environments/everything/local/lib/python2.7/site-packages/kubernaut/cli.py", line 99, in save_config
    json.dump(config_data, cf, indent=2)
  File "/usr/lib/python2.7/json/__init__.py", line 190, in dump
    fp.write(chunk)
TypeError: write() argument 1 must be unicode, not str

Support listing all claims and retrieving claim detail

Once we have multiple claims in the backend and CLI there needs to be a way to actually see all the active claims that a user has.

There should also be a way to get detailed information about a claim such as duration, kubernetes version, and the URL. It would be nice if this information could also be formatted in either text or JSON format for easy consumption from tooling.

Homebrew Formula for macOS users

It would be nice if macOS users could install Kubernaut CLI with the very popular Homebrew tool using something like brew install datawire/kubernaut.

kubernaut claim should print a reminder to set the KUBECONFIG env var

Rather than just telling you where the configuration was written, it should remind you to set KUBECONFIG. Something like

$ kubernaut claim
Warning: Kubernaut does not currently support LoadBalancer services!                                            
Wrote kubernetes config to /home/ark3/.kube/kubernaut   
Reminder: export KUBECONFIG=/home/ark3/.kube/kubernaut

need to handle ci leaking cluster somehow, as well as parallel jobs

kubernaut claim
You attempted to kubernaut claim a cluster but you are already at your maximum claim limit (1). Please release your existing claim kubernaut discard or wait until the existing claim expires.

I ran into the above error message when setting up a travis job. The job barfed before I had a chance to discard my cluster. This seems like a thing that would commonly happen during initial setup.

I think documenting this somewhere, and how to properly release resources in a travis job would be useful. (There is an after_script that I think always runs which can do cleanup even if the job fails.)

Parallel jobs would be an interesting problem as well, given this limit.

Configurable / Selectable Kubernetes Version

Kubernetes is a moving target in terms of features. There is a use case where you want to test software against several versions of Kubernetes very quickly in order to ensure compatibility For example it's reasonable to assume anything from 1.6 to 1.8 is massively in use as of writing and 1.9 is coming down the pipe end of Q4 2017 / beginning of Q1 2018. This feature would allow a user to select a version of Kubernetes to use.

This feature should be designed to accommodate, but not necessarily satisfy an extra requirement that the backend engine can be Kubernetes or OpenShift.

The feature should be exposed to a user during the claim process. A hypothetical command prototype might be kubernaut claim my-cluster --engine kubernetes-v178.

This probably exposes some challenges with kubectl where kubectl on a users machine is not tested to be compatible across all versions that available. That is a later concern and might be addressed by proxying kubectl commands through kubernaut somehow. Separate issue that needs thought post-implementation.

describe documentation is wrong

The kubernaut claims describe documentation seems to be for the delete subcommand.

(venv) [rhs@venture ambassador]$ kubernaut claims describe --help
Usage: kubernaut claims describe [OPTIONS] NAME

  Delete one or more claims

Options:
  --help  Show this message and exit.
(venv) [rhs@venture ambassador]$ kubernaut --version
kubernaut, version 2018.08.13-5b1643b

`kubernaut claims` fails

Pretty sure I'm doing something wrong, but the error message does not point me anywhere :(

$ ./kubernaut claims create --name mycluster
Traceback (most recent call last):
  File "kubernaut/cli.py", line 47, in <module>
  File "site-packages/click/core.py", line 722, in __call__
  File "site-packages/click/core.py", line 697, in main
  File "site-packages/click/core.py", line 1066, in invoke
  File "site-packages/click/core.py", line 1066, in invoke
  File "site-packages/click/core.py", line 895, in invoke
  File "site-packages/click/core.py", line 535, in invoke
  File "site-packages/click/decorators.py", line 27, in new_func
  File "kubernaut/claims/cmd.py", line 68, in create_claim
  File "kubernaut/claims/cmd.py", line 157, in _create_claim
AttributeError: 'NoneType' object has no attribute 'create_claim'
[27707] Failed to execute script cli

missing python dependencies

I hit some trouble. I was doing all this in a python 2.7 virtualenv. Would be good to list what python version you expect.

I followed the pip install instructions and ended up with some broken imports:
ImportError: No module named requests

After installing requests manually, I get this:
ImportError: No module named pathlib

After manually installing pathlib, I get this:

Traceback (most recent call last):
File "/home/rhs/.virtualenvs/kubernaut/bin/kubernaut", line 11, in
load_entry_point('kubernaut==0.1.0', 'console_scripts', 'kubernaut')()
File "/home/rhs/.virtualenvs/kubernaut/lib/python2.7/site-packages/pkg_resources/init.py", line 564, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/home/rhs/.virtualenvs/kubernaut/lib/python2.7/site-packages/pkg_resources/init.py", line 2652, in load_entry_point
return ep.load()
File "/home/rhs/.virtualenvs/kubernaut/lib/python2.7/site-packages/pkg_resources/init.py", line 2306, in load
return self.resolve()
File "/home/rhs/.virtualenvs/kubernaut/lib/python2.7/site-packages/pkg_resources/init.py", line 2312, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "/home/rhs/.virtualenvs/kubernaut/lib/python2.7/site-packages/kubernaut/cli.py", line 15, in
config_root = Path.home() / ".config" / "kubernaut"
AttributeError: type object 'Path' has no attribute 'home'

Tokens are inconveniently long

This isn't a bug, but a UX concern. While the Python client in this git repo stores the token in a file in ~/.config/, gubernaut (used by build-aux.git) wants it in an environment variable. This makes it very convenient to use with CI, just configure it as a regular env-var secret. ...except that it's too long to use as a secure environment variable in .travis.yml:

$ travis encrypt --com KUBERNAUT_TOKEN=[redacted]
Detected repository as datawire/ambassador-oauth, is this correct? |yes| 
data too large - consider using travis encrypt-file or travis env set
$ echo $?
1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.