Giter VIP home page Giter VIP logo

k3x's Introduction

k3x

Build Status Codacy Badge MIT Licence

k3x is a graphical user interface for k3d, making it trivial to have your own local Kubernetes cluster(s).

k3x is perfect for:

  • having a fresh Kubernetes cluster in a couple of seconds.
  • trying new deployments before going in production.
  • learning about Kubernetes.

k3x goals are:

  • to create/switch-to/destroy Kubernetes clusters easily.
  • to drive the most important operations with global keyboard shortcuts.
  • to reduce the learning curve of using Kubernetes.

Documentation

Quick start

Pre-requisites

  • A Docker daemon. It can be both a local or a remote one... but things are easier with a local one. Follow these instructions for installing Docker in your machine.
  • Some Linux distribution where you can install Flatpak packages. Most modern linux distros have built-in support, but you can find more details on flatpaks in our installation instructions.

Installing k3x

The preferred installation method is from the Flathub. Just visit the k3x page at the Flathub (built from this repo) or click in the following link:

Download on Flathub

From command line, you can install it with

flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install --user flathub com.github.inercia.k3x

You can also use one of the .flatpak files provided in our releases page but you should first take a look at the instructions for your distro for some peculiarities.

Running k3x

Once k3x is installed it should be available from your launcher (ie, the GNOME Shell, your Applications menu, etc.). But you can also run it from the command line with:

flatpak run --user com.github.inercia.k3x

This also print the application log when started from the terminal, useful for debugging. Check out the troubleshooting guide if something goes wrong.

Once k3x is running you will see a new icon in your system tray that will unroll a menu when clicked:

By clicking in the

And you could also try master the global keyboard shortcuts for quicly creating/destroying clusters with a keystroke.

Contributing to k3x

  • First, make sure the flatpak-builder is available in your machine.
  • You can fork and clone this repo (if you plan to contribute) or just download it in some directory in your laptop.
  • Install all dependencies with:
    make deps
    
  • Then you can run it with:
    make run

k3x's People

Contributors

danielmellado avatar inercia avatar maiki avatar roming22 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

k3x's Issues

dateutil not found

Running k3x from Flathub on Fedora 32 Silverblue, and I get:

GI search path:
[PRE-MAIN]  [search-path] - /usr/lib/x86_64-linux-gnu/girepository-1.0
[PRE-MAIN]  [search-path] - /app/lib/girepository-1.0
[PRE-MAIN]  [search-path] - /app/lib/girepository-1.0
[PRE-MAIN] Current LD_LIBRARY_PATH: /app/lib:/app/lib/x86_64-linux-gnu:/lib64:/lib:/usr/lib64:/usr/lib:/usr/local/lib
Traceback (most recent call last):
  File "/app/bin/k3x", line 61, in <module>
    from k3x import main
  File "/app/share/k3x/k3x/main.py", line 42, in <module>
    from .menu import K3dvMenu
  File "/app/share/k3x/k3x/menu.py", line 29, in <module>
    from .cluster_view import ClusterDialog
  File "/app/share/k3x/k3x/cluster_view.py", line 45, in <module>
    from .k3d import K3dCluster
  File "/app/share/k3x/k3x/k3d.py", line 27, in <module>
    from dateutil.parser import parse
ModuleNotFoundError: No module named 'dateutil'

FWIW: I don't have anything Kubernetes-related on my machine. (Not sure if it's needed or not; from the description, I assumed this should handle everything.)

Usage without tray icon?

I'd appreciate it if it could be possible to have a main window with access to the same info as the tray icon, and make that icon optional.

Gnome removed tray long ago, and I live happier without it.

keybindings consume too much CPU

The current keybindings code seems to consume too much CPU (and power). We should look for an alternative, but this could turn out to be a tough problem: finding a portable library that could bind to global keybinding proved to be difficult in the past...

Settings: enable host-gw networking

k3x should have some setting for using host-gw networking (and maybe some other flannel plugins).

When host-gw is enabled, we could also give the option of routing to the cluster IPs subnet through the master.

Run this without flatpack?

Is there any way to run this without installing flatpack? How about building from code? Anything would help -- I can't put flatpack on my system because security matters and flatpack is the opposite of that, but I 'd really like to have a look at this project.

`make build` fails after regenerating the pypi-dependencies.json

make build ends in error:

> make build
>>> Downloading dependencies (in build_dir=/home/rarnaud/Code/k3x/.flatpak-builder/build/staging)...
Emptying app dir '/home/rarnaud/Code/k3x/.flatpak-builder/build/staging'
Downloading sources
Stopping at module k3x
>>> Building dependencies (in build_dir=/home/rarnaud/Code/k3x/.flatpak-builder/build/staging)...
Starting build of com.github.inercia.k3x
Cache hit for intltool, skipping build
Cache hit for dbus-glib, skipping build
Cache hit for libdbusmenu, skipping build
Cache hit for libindicator, skipping build
Cache hit for libappindicator, skipping build
Cache hit for kubectl, skipping build
Cache miss, checking out last cache hit
========================================================================
Building module python3-xcffib in /home/rarnaud/Code/k3x/.flatpak-builder/build/python3-xcffib-9
========================================================================
Running: pip3 install --exists-action=i --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST} "xcffib"
Looking in links: file:///run/build/python3-xcffib
Collecting xcffib
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-3iimqez3/xcffib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-3iimqez3/xcffib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
         cwd: /tmp/pip-install-3iimqez3/xcffib/
    Complete output (25 lines):
    Download error on https://pypi.org/simple/cffi/: [Errno -3] Temporary failure in name resolution -- Some packages may not be found!
    Couldn't find index page for 'cffi' (maybe misspelled?)
    Download error on https://pypi.org/simple/: [Errno -3] Temporary failure in name resolution -- Some packages may not be found!
    No local packages or working download links found for cffi>=1.1.0
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-3iimqez3/xcffib/setup.py", line 90, in <module>
        **cffi_args
      File "/usr/lib/python3.7/site-packages/setuptools/__init__.py", line 144, in setup
        _install_setup_requires(attrs)
      File "/usr/lib/python3.7/site-packages/setuptools/__init__.py", line 139, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/usr/lib/python3.7/site-packages/setuptools/dist.py", line 719, in fetch_build_eggs
        replace_conflicting=True,
      File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 782, in resolve
        replace_conflicting=replace_conflicting
      File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1065, in best_match
        return self.obtain(req, installer)
      File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1077, in obtain
        return installer(requirement)
      File "/usr/lib/python3.7/site-packages/setuptools/dist.py", line 786, in fetch_build_egg
        return cmd.easy_install(req)
      File "/usr/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 673, in easy_install
        raise DistutilsError(msg)
    distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('cffi>=1.1.0')
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Error: module python3-xcffib: Child process exited with code 1
make: *** [Makefile:142: /home/rarnaud/Code/k3x/.flatpak-builder/build/staging/build.ninja] Error 1

I'm not sure how to fix that...
That's preventing me to test and submit a PR for issue #24 (I need to add paramiko to requirements.txt, regenerate the dependencies and validate with a build and run).

any chance for a web-ui?

my k3d instances are always run on minimal remote machines and we don't have an opportunity to install X. Any chance a web-ui will be built for the graphical part? Thanks.

Fedora Silverblue support?

Silverblue doesn't have a "normal" package manager. All installations are the same. One can "overlay" RPMs (and their dependencies), but most of the time, all the work happens in Flatpaks and podman containers (especially toolbox containers, which are a special type of long-term podman contaner that simulates a standard Fedora installation, with dnf/yum and so on).

What's probably needed is to have podman support (#15) and ensure that nothing else is needed from the host system.

Check clusters are running when starting

Some clusters can be stopped when k3x is started. Users could think the current cluster should be ready, but they would really need to "start" it. We should show a warning saying something like "the current cluster is stopped".

cluster up but unreachable

flatpak run --user com.github.inercia.k3x
2023-10-29 21:58:49,712 [MainThread  ] [INFO ]  [K3D] Activating cluster 'k3s-cluster-692'
2023-10-29 21:58:49,712 [MainThread  ] [DEBUG]  [KUBECTL] Running kubectl command ('config', 'use-context', 'k3s-cluster-692')
2023-10-29 21:58:49,748 [MainThread  ] [DEBUG]  k3s-cluster-692 is the new active cluster.
kubectl config view -o jsonpath='{.contexts}' -o yaml
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://localhost:7296
  name: k3s-cluster-692
contexts:
- context:
    cluster: k3s-cluster-692
    user: k3s-cluster-692
  name: k3s-cluster-692
current-context: k3s-cluster-692
kind: Config
preferences: {}
users:
- name: k3s-cluster-692
  user:
    password: REDACTED
    username: admin
curl -k https://localhost:7296/healthz
curl: (7) Failed to connect to localhost port 7296 after 0 ms: Connection refused

I installed the Flatpak by clicking the install button in the Elemental AppCenter.

cat /etc/lsb-release /etc/os-release
DISTRIB_ID=Pop
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Pop!_OS 22.04 LTS"
NAME="Pop!_OS"
VERSION="22.04 LTS"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 22.04 LTS"
VERSION_ID="22.04"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=jammy
UBUNTU_CODENAME=jammy
LOGO=distributor-logo-pop-os

Add dependencies to the contributing section in README.md

Following the instructions leads to

> make run
>>> Downloading dependencies (in build_dir=/home/rarnaud/Code/k3x/.flatpak-builder/build/staging)...

(flatpak-builder:4806): flatpak-builder-ERROR **: 11:56:20.602: Failed to load included manifest (/home/rarnaud/Code/k3x/shared-modules/libappindicator/libappindicator-gtk3-introspection-12.10.json): Failed to open file “/home/rarnaud/Code/k3x/shared-modules/libappindicator/libappindicator-gtk3-introspection-12.10.json”: No such file or directory
make: *** [Makefile:140: /home/rarnaud/Code/k3x/.flatpak-builder/build/staging/build.ninja] Trace/breakpoint trap (core dumped)

Traceback when running k3x from flatpak

When trying to run k3x from flatpak I get a GTK traceback error.

$ flatpak run --user com.github.inercia.k3x
GI search path:
[PRE-MAIN]  [search-path] - /usr/lib/x86_64-linux-gnu/girepository-1.0
[PRE-MAIN]  [search-path] - /app/lib/girepository-1.0
[PRE-MAIN]  [search-path] - /app/lib/girepository-1.0
[PRE-MAIN] Current LD_LIBRARY_PATH: /app/lib:/app/lib/x86_64-linux-gnu:/lib64:/lib:/usr/lib64:/usr/lib:/usr/local/lib
2020-09-17 13:14:30,830 [MainThread  ] [DEBUG]  [MAIN] Creating settings manager...
2020-09-17 13:14:30,839 [MainThread  ] [DEBUG]  Creating settings in delayed mode...
2020-09-17 13:14:30,839 [MainThread  ] [INFO ]  Changing loglevel to 20
2020-09-17 13:14:30,839 [MainThread  ] [INFO ]  [MAIN] Using icon /home/dmellado/.var/app/com.github.inercia.k3x/cache/icons/app.svg
2020-09-17 13:14:30,839 [MainThread  ] [INFO ]  [MAIN] Starting appindicator.Indicator
2020-09-17 13:14:30,865 [MainThread  ] [INFO ]  Creating/recreating docker client with DOCKER_HOST=unix:///var/run/docker.sock

(k3x:2): Gtk-CRITICAL **: 13:14:31.013: gtk_entry_set_text: assertion 'text != NULL' failed
Traceback (most recent call last):
  File "/app/bin/k3x", line 62, in <module>
    sys.exit(main.main(VERSION))
  File "/app/share/k3x/k3x/main.py", line 139, in main
    _indicator = Indicator(version=version)  # NOTE: assign for keeping the object alive
  File "/app/share/k3x/k3x/main.py", line 113, in __init__
    self._keybinder = Keybindings(self._settings, self._shortcuts)
  File "/app/share/k3x/k3x/keybindings.py", line 85, in __init__
    self._keybinder = SystemHotkey(check_queue_interval=0.01)
  File "/app/lib/python3.7/site-packages/system_hotkey/system_hotkey.py", line 614, in __init__
    self.conn = xcffib.connect()
  File "/app/lib/python3.7/site-packages/xcffib/__init__.py", line 527, in __init__
    self.invalid()
  File "/app/lib/python3.7/site-packages/xcffib/__init__.py", line 559, in invalid
    raise ConnectionException(err)
xcffib.ConnectionException: Connection closed, error during parsing display string.

Settings: customize dashboard

When users click on "New cluster" they have the option for installing a Dashboard.

Screenshot from 2020-07-13 11-10-49

It is not clear which dashboard is installed. That should be configurable in the "Preferences", so users should be able to choose a different one.

Cannot use docker via a SSH URL

The validation of the URL always fails with 'ssh://user@ip' is not a valid Docker URL..
In the shell DOCKER_HOST=ssh://user@ip docker info runs fine.

The root cause is that the call to docker.DockerClient in docker.py fails because paramiko is not available.

`make generate` fails on xpybutil and system_hotkey

The error is thrown by https://github.com/flatpak/flatpak-builder-tools/blob/master/pip/flatpak-pip-generator:

Traceback (most recent call last):
  File "build-aux/flatpak-pip-generator", line 227, in <module>
    url = get_tar_package_url_pypi(name, version)
  File "build-aux/flatpak-pip-generator", line 64, in get_tar_package_url_pypi
    raise Exception(err)
Exception: Failed to get xpybutil-0.0.6 source from https://pypi.org/pypi/xpybutil/0.0.6/json

Reverting to an older version of flatpak-pip-generator solves the issue (I tried 3b460d29d6c58eabdccce2595faa2d512fa0259d since it was likely the version last used by the main developer, as the enxt commit remove any.whl support).

Edit: Changed latest know working version

Problems starting k3x

I'm seeing the following stacktrace when trying to run k3x:

GI search path:
[PRE-MAIN]  [search-path] - /usr/lib/x86_64-linux-gnu/girepository-1.0
[PRE-MAIN]  [search-path] - /app/lib/girepository-1.0
[PRE-MAIN]  [search-path] - /app/lib/girepository-1.0
[PRE-MAIN] Current LD_LIBRARY_PATH: 

** (k3x:2): WARNING **: 04:48:33.932: Failed to load shared library 'libgranite.so.5.4.0' referenced by the typelib: libgranite.so.5.4.0: cannot open shared object file: No such file or directory
/usr/lib/python3.7/site-packages/gi/types.py:220: Warning: cannot derive 'k3x+utils_ui+SettingsPage' from non-derivable parent type 'void'
  _gi.type_register(cls, namespace.get('__gtype_name__'))
Traceback (most recent call last):
  File "/app/bin/k3x", line 61, in <module>
    from k3x import main
  File "/app/share/k3x/k3x/main.py", line 41, in <module>
    from .docker import DockerController
  File "/app/share/k3x/k3x/docker.py", line 31, in <module>
    from .utils_ui import show_notification
  File "/app/share/k3x/k3x/utils_ui.py", line 237, in <module>
    class SettingsPage(Granite.SimpleSettingsPage):
  File "/usr/lib/python3.7/site-packages/gi/types.py", line 229, in __init__
    super(GObjectMeta, cls).__init__(name, bases, dict_)
  File "/usr/lib/python3.7/site-packages/gi/types.py", line 208, in __init__
    cls._type_register(cls.__dict__)
  File "/usr/lib/python3.7/site-packages/gi/types.py", line 220, in _type_register
    _gi.type_register(cls, namespace.get('__gtype_name__'))
RuntimeError: could not create new GType: k3x+utils_ui+SettingsPage (subclass of void)

I'm running arch linux with KDE.
What caught my eye was that LD_LIBRARY_PATH env that's empty. Any ideia on how to get it to run?

end-of-life of dependency org.gnome.Platform//3.36

Though this project seems to be abandoned, I'll give it a try...

The dependency org.gnome.Platform//3.36 has reached its end-of-life.

Info: org.gnome.Platform//3.36 is end-of-life, with reason:
The GNOME 3.36 runtime is no longer supported as of February 13, 2021. Please ask your application developer to migrate to a supported platform.

On cluster recycle, choose the oldest cluster

When we recycle a cluster we are

  1. creating a new cluster
  2. activating a random cluster among the remaining clusters
  3. destroing a random cluster among the remaining clusters.

We should sort clusters by age and 1) destroy the oldest cluster 2) activate the next cluster in age.

Display errors in a graphical way

When launching k3x from its app icon and it encounters an error, nothing shows up.

(To see tracebacks, one must currently run the app from the command line.)

Podman support?

Fedora, CentOS, and Red Hat Enterprise Linux have dropped Docker (Moby) and switched to Podman, which doesn't require a daemon. It does have API support (which is what we're using in cockpit-podman) We're specifically the new Podman 2.0 API, not the deprecated varlink API.

The new API has a podman-specific API and a Docker-compatible version.

Podman's API is documented at https://docs.podman.io/en/latest/_static/api.html and there's a simple overview @ https://www.redhat.com/sysadmin/podmans-new-rest-api

Try to show accurate information for exiting clusters

After creating a cluster, we can click on the cluster for getting some info:

Screenshot from 2020-07-13 10-37-06

However, most of the properties are disabled (because they cannot be changed once the cluster I created), but the info they show is not accurate (ie, the number of workers). We should at least try to show accurate information by inspecting the cluster.

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.