Skip to content

Commit

Permalink
readme: update content
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanCacqueray committed Jan 4, 2020
1 parent a19dd6f commit eb3fac0
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 101 deletions.
11 changes: 0 additions & 11 deletions Containerfile

This file was deleted.

111 changes: 21 additions & 90 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,120 +10,51 @@ a desktop workstation:
This process is pretty much an experimental work in progress,
use at your own risk.

Demo video: [https://youtu.be/w86Dp5D8Xag](https://youtu.be/w86Dp5D8Xag)

Install
-------

Setup
-----
* On a fedora-30 system, install the pre-built package:

On a fedora-30 server virtual machine:
```shell
sudo dnf install -y $SILVERKUBE_RPM_RELEASE_URL
```

* Prepare the host
* Or build the package locally using:

```shell
$ sudo dnf install -y buildah podman
# umount tmp if instance has less than 1GB for buildah
$ sudo umount /tmp
python3 build.py
```

* Build and install the service
* Or build the package inside a container:

```shell
$ mkdir -p ~/.cache/silverkube
$ podman run --rm -it \
mkdir -p ~/.cache/silverkube
podman run --rm -it \
-v $HOME/.cache/silverkube:/root/.cache/silverkube:Z \
-v $(pwd):/data:Z --workdir /data \
registry.fedoraproject.org/fedora:30 python3 build.py
$ sudo dnf install -y ./rpmbuild/RPMS/x86_64/silverkube*.rpm
registry.fedoraproject.org/fedora:31 python3 build.py
```

* Build the silverkube image

```shell
# Use vfs-storage for rootless crio
$ buildah --storage-driver vfs --root $HOME/.local/share/silverkube/storage/ \
--runroot /tmp/1000 bud -f Containerfile -t silverkube desktop
```

Usage
-----

* Start the services
* Start the services rootless

```shell
$ sudo mount /tmp
$ silverkube start
Starting silverkube-rootlesskit
Starting silverkube-crio
Starting silverkube-etcd
Starting silverkube-kube-apiserver
Starting silverkube-kube-controller-manager
Starting silverkube-kube-scheduler
Starting silverkube-kubelet
Checking silverkube-rootlesskit
active
Checking silverkube-crio
active
Checking silverkube-etcd
active
Checking silverkube-kube-apiserver
active
Checking silverkube-kube-controller-manager
active
Checking silverkube-kube-scheduler
active
Checking silverkube-kubelet
active
[...]
up!
namespace/fedora created
serviceaccount/fedora created
alias kubectl='/home/fedora/.local/bin/rootless-join kubectl --config /home/fedora/.config/silverkube/kubeconfig.user'
alias kubectl='/home/fedora/.local/bin/rootless-join kubectl --kubeconfig /home/fedora/.config/silverkube/kubeconfig'
```

* Start the desktop

* Or start the services as root
```shell
$ kubectl apply -f desktop.yaml
persistentvolume/pulse-socket created
persistentvolume/xorg-socket created
persistentvolumeclaim/pulse-socket created
persistentvolumeclaim/xorg-socket created
pod/display-server created
pod/window-manager created
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
display-server 1/1 Running 0 81s
window-manager 1/1 Running 0 24s
$ kubectl exec -it window-manager ps afx
PID TTY STAT TIME COMMAND
26 pts/2 Rs+ 0:00 ps afx
1 pts/0 Ss+ 0:00 /bin/xmonad
8 ? Ss 0:00 xterm
10 pts/1 Ss+ 0:00 \_ bash
```

* Stop everything:

```shell
$ kubectl delete -f desktop.yaml
persistentvolume "pulse-socket" deleted
persistentvolume "xorg-socket" deleted
persistentvolumeclaim "pulse-socket" deleted
persistentvolumeclaim "xorg-socket" deleted
pod "display-server" deleted
pod "window-manager" deleted
$ sudo silverkube stop
Stopping silverkube-kubelet
Stopping silverkube-crio
Stopping silverkube-kube-scheduler
Stopping silverkube-kube-controller-manager
Stopping silverkube-kube-apiserver
Stopping silverkube-etcd
down!
$ sudo silverkube start
[...]
up!
alias kubectl='kubectl --kubeconfig /etc/silverkube/kubeconfig'
```

Roadmap
-------

* implement a tool such as [podenv](https://github.com/podenv/podenv) to start applications from the desktop environment.
* start kube and crio service as unprivileged user.
* Stop the services using `stop` argument
22 changes: 22 additions & 0 deletions desktop/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM registry.fedoraproject.org/fedora:31

RUN dnf install -y acl attr basesystem bash file pciutils which time \
bind-utils iproute tcpdump nmap-ncat \
bc bzip2 gnupg2 htop less lsof procps-ng psmisc strace sudo \
tar tree unzip vim-enhanced \
sway \
xorg-x11-xauth xorg-x11-drv-vesa xorg-x11-drv-evdev \
xorg-x11-drv-fbdev xorg-x11-drv-intel xorg-x11-drv-libinput \
xorg-x11-drv-qxl xorg-x11-drv-vesa xorg-x11-utils xorg-x11-xkb-utils \
xterm xorg-x11-server-Xspice xorg-x11-twm \
kubernetes-client

# Fix Xorg startup issue
RUN bash -c "echo allowed_users = anybody > /etc/X11/Xwrapper.config"

# Ensure unprivileged user has environment
RUN useradd -u 1000 -m fedora && \
mkdir -p /run/user/1000 && chown 1000:1000 /run/user/1000 && \
mkdir -p /run/user/0 && chown 0:0 /run/user/0

COPY tools/* /bin/
1 change: 1 addition & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Test deployment with basic objects
10 changes: 10 additions & 0 deletions tests/test-pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Pod
metadata:
name: test
spec:
restartPolicy: Never
containers:
- name: test
image: fedora
command: ["/bin/sleep", "Inf"]
89 changes: 89 additions & 0 deletions tests/test-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
apiVersion: v1
items:
- apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/component: postgres
app.kubernetes.io/instance: demo
app.kubernetes.io/name: demo
app.kubernetes.io/part-of: app
name: postgres
spec:
ports:
- name: pg
port: 5432
protocol: TCP
targetPort: pg
selector:
app.kubernetes.io/component: postgres
app.kubernetes.io/instance: demo
app.kubernetes.io/name: demo
app.kubernetes.io/part-of: app
type: ClusterIP
- apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/component: postgres
app.kubernetes.io/instance: demo
app.kubernetes.io/name: demo
app.kubernetes.io/part-of: app
name: demo-postgres
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/component: postgres
app.kubernetes.io/instance: demo
app.kubernetes.io/name: demo
app.kubernetes.io/part-of: app
template:
metadata:
labels:
app.kubernetes.io/component: postgres
app.kubernetes.io/instance: demo
app.kubernetes.io/name: demo
app.kubernetes.io/part-of: app
name: postgres
spec:
containers:
- image: docker.io/library/postgres:12.1
name: postgres
ports:
- containerPort: 5432
name: pg
- apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/component: worker
app.kubernetes.io/instance: demo
app.kubernetes.io/name: demo
app.kubernetes.io/part-of: app
name: demo-worker
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/component: worker
app.kubernetes.io/instance: demo
app.kubernetes.io/name: demo
app.kubernetes.io/part-of: app
template:
metadata:
labels:
app.kubernetes.io/component: worker
app.kubernetes.io/instance: demo
app.kubernetes.io/name: demo
app.kubernetes.io/part-of: app
name: worker
spec:
containers:
- args:
- sh
- "-c"
- "python3 -c 'import socket, sys; socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect((sys.argv[1], 5432))' postgres;echo Connected; sleep infinity"
image: registry.fedoraproject.org/fedora:31
name: worker
kind: List

0 comments on commit eb3fac0

Please sign in to comment.