Giter Club home page Giter Club logo

kube-admin's Introduction

Kube-admin (Alpha)

devDependency Status Code Climate Build Status

KubeADMIN is an administration dashboard for Kubernetes. It allows you to inspect and manage resources such as Node, Pods, ReplicationControllers, Services, etc.

Documentation can be found here

A demo site, using a fake server backed by the awesome Ember mirage can be found here

kube-admin's People

Contributors

holandes22 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

kube-admin's Issues

E2E test

Get a k8s cluster up and running in with container to run the acceptance tests against it

List details

  • Name
  • Namespace
  • Created (add to the timestamp a human readable: "2 days ago")

Test cases

  • Connection error

Enhacements for resource details

Service

clusterIP can be an anchor tag that opens in a new tab

RC containers

In ports sections

  • if hostPort is null, show the same value as in containerPort.
    Consider adding resource limits to the details.

Allow host:port selection

  • Add a settings section where the selection can be made
  • Show selected hostname in a visible way at the sidebar
  • User navigates to "/settings"
    • Is presented with a form to enter host:port values.
  • User navigates to any other route (/pods, /pods/name, etc)
    • When entering the route, the model hook will try to fetch info from the host,. If an error occurs, show an error message

Show pod logs

We need to specify for which container we are showing the logs with the container query param

http://localhost:8080/api/v1/namespaces/default/pods/k8s-master-127.0.0.1/log?container=controller-manager

so the URL should be

namespaces/default/pods/k8s-master-127.0.0.1/log?container=controller-manager

After scaling, value gets out of sync

When issuing a scale request for RC, the value in the replicas input might not be necessarily in sync.

If we refresh the model, the server might still return the old value. We should somehow reflect this correctly to avoid a subsequent rescale to be wrong.

Either:

  • refresh the model after a few seconds to allow the API to catch up
  • Show the value as "in flight" or "out of sync" and disable the action button until it syncs up

Containers list and details redesign

The pod details page looks very cumbersome right now due to the huge amount of info being shown.

The idea is to break stuff down by having a separate route for container details.

  • Refactor container-details component
    • rename to rc-container-list
    • remove status stuff as it is only relevant for pods. adapt tests accordingly
    • move details with status stuff to new component: pod-container-details along with the relevant tests
  • Add links to details and logs from pod container cards. Add a new pod-container-list component to be used in the pod details route. List should only appear if containerStatuses is present
  • Add route for container details
    • pass "model" (container json including status) in link-to from cards
    • Model hook of the route will have to fetch pod and retrieve the relevant container and status from the pod response, matching by name (there is logic to do that in container details component so that might need to be extracted)
  • NOTE!: if pod phase is pending, the response won't contain a list of statuses for the containers. In this case we should clearly indicate that status cannot be retrieved (and show some color code in Phase at the details list). Also, this case needs to be contemplated when browsing directly to the containers/:container route

Remaining tasks

  • Add tests for pod-containers component
  • Add tests to container route
    - no status (pod is down)
  • Add link to logs in container details
  • Remove old containers-details component and its tests

Fix connect-src CSP

We might need a wildcard here as API address can be anything

Content Security Policy violation:

{
"csp-report": {
"document-uri": "http://localhost:4200/pods",
"referrer": "http://localhost:4200/pods",
"violated-directive": "connect-src 'self' ws://localhost:49152 ws://0.0.0.0:49152 http://localhost:4200",
"effective-directive": "connect-src",
"original-policy": "default-src 'none'; script-src 'self' localhost:49152 0.0.0.0:49152; font-src 'self' https://fonts.gstatic.com data:; connect-src 'self' ws://localhost:49152 ws://0.0.0.0:49152 http://localhost:4200; img-src 'self' data:; style-src 'self' http://fonts.googleapis.com; media-src 'self'; report-uri http://localhost:4200/csp-report;",
"blocked-uri": "http://localhost:8080",
"source-file": "http://localhost:4200/assets/vendor.js",
"line-number": 8795,
"column-number": 9,
"status-code": 200
}
}

Deployment options

  • Deploy in a container (make an image with nginx). Image should be downloadable from docker hub or github
  • Deploy in a pod (similar to kubernetes UI). Create a container, add manifest file and use proxy to the pod route
  • Quick deploy with python simple http server
  • https://github.com/felixrieseberg/ember-electron

JSON parse error when retrieving logs

The kube client sends a request to the API

/api/v1/namespaces/default/pods/somepod/log?container=somecontainer

The API responds with a clear text, and for some reason, jquery tries to parse this as json (even thought the content type is plain/text) thus triggering an error causing ember-ajax to reject the promise. So in kube client, even tough the request returns with 200, we cannot see the response in the resolve path.

We added a workaround for this in #16 to use a catch in the promise, inspect the response and obtain the log from there. but this is mighty ugly.

There are also other problems, like the API returning inconsistent responses (some error messages are included in the text content with a 200 status making it hard to tell if we got the log or something else), for example:

  • if you send a bad query param, for eample sinceTime=aaa (expects RFC3339 date) you get an expected JSON error response with status 406
  • If you send a ?container=nonExisting, instead of returning a JSON error it returns the response as plain text with a content like "container not found" and HTTP status 200
  • If the pod is in Pending state (so there are no logs), similar a above, sends an error message in the content and HTTP status 200

What to do:

  1. Open a ticket in kubernetes to get more consistent error responses in that endpoint
  2. Figure out why jquery tries to parse the response as JSON (but this could be the API misbehaving here)

Creation of resources

  • Namespace
  • Pod
  • rc
  • Service

We need a namespace to know the URL for creation. The namespace can be infered from the manifest.
check http://kubernetes.io/v1.1/docs/api-reference/v1/definitions.html#_v1_objectmeta)

If no namespace is defined, then the value "default" will be used

Not all resources use namespaces, but the ones we deal right now do (rc, pod, service).
See last section at http://kubernetes.io/v1.1/docs/user-guide/namespaces.html

Test cases

  • General error
  • Resource already exists (409?)
  • Ok redirects to list

Documentation and demo sites

Docs content

Refactor to avoid duplication (code and tests) in resource list

The routes and templates are essentially the same. this seems to be a component.

Check how can we migrate the acceptance tests to integration tests if we do put everything in a component.

Consider also removing some of the acceptance tests if we are covered by integration (as they run slower)

Ideas of features for version after first release

Need to expand on the ideas and open tickets for each.

Add management and visualization for:

  • nodes
  • events
  • volumes and volume claims

Monitoring:

  • instance resource usage (metrics, warnings on high usage?)
  • Notify on status changes, warning or errors (side pane with activity feed)
  • Statue, warning and error report.

Services

Show the service in bad state if the pod that lives on is in bad shape

Dashboard:

Dashboard:

  • Glance at resources that in bad state
  • Glance at running services and containers
  • Glance at node activity (load) and resource usage in each

Move current polled stats to a different page to avoid clutter?

UX Improvements for host selection

Possible improvements:

  • Show link to settings in error message if connection error
  • Add a "test connection" feature in settings
    1. connection is good: show green
    2. connection is bad: show red
  • Store user selection in cookie or localstorage

Code cleanup and needed refactor

This ticket is to list places in the codebase that are problematic. Before reaching a stable release I should go over this, open ticket for each item and work on them

  • There is plenty of repetition in test code (specially in acceptance test). We need to find a way to parametrize the tests.
  • rename data-autoid to just data-id
  • Be consistent with use of let/const http://madhatted.com/2016/1/25/let-it-be
  • #31
  • The resource-details component
    • is huge and convoluted, might be possible to clean it up a little.
    • the variable name model is wrong, use manifest instead
    • yield usage is weird as it leaks format (user must comply to table format)
  • There code repetition for the error handler API response, this can be extracted to a fun. check promise catch in list mixin, rc route, delete action mixin
  • The input component used in the settings form component is coupled to it so it should be nested under it

Resource details

Details

Common

  • Name: metadata.name
  • Creation timestamp: metadata.creationTimestamp

Common for services, pods and rcs

  • Metadata: metadata
    • Namespace: .namespace
    • Labels: .labels K:V iteration

Pods

  • Status: status
    • Host IP address: .hostIP
    • Pod IP address: .podIP
    • Start time: .startTime
    • Phase: .phase
  • Spec: see spec section

Services

  • Ports: spec.ports K:V iteration
  • Cluster IP address: spec.clusterIP
  • Session affinity: spec.sessionAffinity

ReplicationController

  • Status: status
    • Observed generation: .observedGeneration
    • Replicas: .replicas
  • Spec: see spec section

spec (Pod and RC)

  • Spec: spec
    • Containers: .containers[]
      • Name: .name
      • Image: .image
      • Ports: .ports K:V iteration
      • Image pull policy: .imagePullPolicy (One of Always, Never, IfNotPresent)
    • Restart policy: .restartPolicy (One of Always, OnFailure, Never)
    • Termination grace period (s): .terminationGracePeriodSeconds
    • DNS Policy: .dnsPolicy (One of ClusterFirst or Default)
    • Node name: .nodeName
    • Host network? .hostNetwork
    • Container statuses: .containerStatuses[]
      • Ready? .ready
      • Restart count: .restartCount
      • State: .state (see http://kubernetes.io/v1.1/docs/api-reference/v1/definitions.html#_v1_containerstate)
        • if running: Show "running" in GREEN and .running.startedAt
        • if waiting: Show "waiting" in YELLOW and .waiting.reason
        • if terminated: Show "terminated" in RED and .exitCode, .reason, .startedAt, .finishedAt
      • Last state: .lastState simply show running, waiting, terminated in black
      • Image ID: .imageID
      • Container ID: .containerID

Resource deletion

  • Pods, RC, service, namespaces
  • From within details screen
  • Should ask for confirmation prior to delete

ReplicationController rolling update

  • By manifest
  • By image (investigate if supported by API. would be nice to show a list of available images)

Additional options:

--dry-run=false: If true, print out the changes that would be made, but don't actually make them.
--poll-interval="3s": Time delay between polling for replication controller status after the update. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
--rollback=false: If true, this is a request to abort an existing rollout that is partially rolled out. It effectively reverses current and next and runs a rollout
--timeout="5m0s": Max time to wait for a replication controller to update before giving up. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
--update-period="1m0s": Time to wait between updating pods. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".

Remove the namespaces section

Basically, a namespace is created if it does not exists when creating other resources, so no much use for it.
Consider taking it out

UI Design enhancements

  • Logo can be a pirate handling a wheel
  • Add favicon using the logo
  • Container painted a 404 for the not found route

ReplicationController scaling

  1. Do GET request to http://localhost:8080/api/v1/namespaces/default/replicationcontrollers/data-processor
  2. Get the spec.replicas value, if the same return OK
  3. if not the same modify the manifest. spec.replicas value with the new value
  4. Do PUT request to same URL

We need an input component that allows to spin up or down the value,

  • The input should be a number >= 0

Form

  • If invalid inputs, submit button is invalid
  • On submit, trigger action
  • Action will
    • Get model (spec)
    • if new value is the same as in spec do nothing
    • Else, replace the value in spec and send a PUT request. Show a flash message, and refresh after a few second (although change might not be reflected right away, only after k8s finished adding/removing the replication)

Avoid parsing large files in manifest input component

We parse files on open in order to validate them and show a preview before sending them to the backend, buut if the file is quite large we won't be able to open and might cause 100% and halt the browser/tab.
This will typically happen with large binaries, manifest files should never be so large, so in the case of a large file, skip validation/preview and just catch an error from the API if it is indeed invalid

Watch for changes made elsewhere, and update current page if relevant

Changes in CLI or other admin should be reflected in lists and details.

The API provides a watch endpoint that might be useful here, but need to better understand it to see if it does what I think.

Consider only watching for changes relevant to the current viewport (no need to see changes in pods/services/rc if we stand in the namespaces list screen)

Consider using a web worker to track changes. Check out https://github.com/runspired/skyrocket and http://blog.runspired.com/ and https://www.youtube.com/watch?v=v6e5gNfYBnk

or ember-concurrency

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.