https://github.com/jwillikers/unifi-controller
A Kubernetes configuration file for running the UniFi Controller with Podman
https://github.com/jwillikers/unifi-controller
containers docker kubernetes kubernetes-configuration okd podman systemd unifi-controller
Last synced: 9 months ago
JSON representation
A Kubernetes configuration file for running the UniFi Controller with Podman
- Host: GitHub
- URL: https://github.com/jwillikers/unifi-controller
- Owner: jwillikers
- License: other
- Archived: true
- Created: 2021-03-13T16:24:09.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-03-13T20:10:28.000Z (almost 5 years ago)
- Last Synced: 2025-04-06T21:52:14.882Z (9 months ago)
- Topics: containers, docker, kubernetes, kubernetes-configuration, okd, podman, systemd, unifi-controller
- Homepage:
- Size: 23.4 KB
- Stars: 7
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE.adoc
- Code of conduct: CODE_OF_CONDUCT.adoc
Awesome Lists containing this project
README
= UniFi Controller
Jordan Williams
:experimental:
:icons: font
ifdef::env-github[]
:tip-caption: :bulb:
:note-caption: :information_source:
:important-caption: :heavy_exclamation_mark:
:caution-caption: :fire:
:warning-caption: :warning:
endif::[]
:Podman: https://podman.io/[Podman]
:podman-generate-systemd: https://docs.podman.io/en/latest/markdown/podman-generate-systemd.1.html[podman-generate-systemd(1)]
:podman-play-kube: https://docs.podman.io/en/latest/markdown/podman-play-kube.1.html[podman-play-kube(1)]
:systemd: https://systemd.io/[systemd]
A Kubernetes configuration file for running the UniFi Controller with {Podman}.
== Synopsis
Run the UniFi controller in a rootless container via {Podman}, configure it as a systemd service, and automate image updates.
This project uses the https://github.com/linuxserver/docker-unifi-controller[docker-unifi-controller] image provided by https://www.linuxserver.io/[LinuxServer.io] and uses a Kubernetes configuration file similar to the provided docker-compose.
== Getting Started
The instructions here have been tested on Ubuntu 18.04.
. Follow the https://podman.io/getting-started/installation[Podman installation instructions] to install Podman.
. Clone this project's Git repository.
+
[source,sh]
----
➜ git clone https://github.com/jwillikers/unifi-controller.git ~/Projects/unifi-controller
----
. Use {podman-play-kube} to create the _unifi-controller_ pod.
The instructions here use rootless Podman containers running under the current user for increased security.
+
--
[source,sh]
----
➜ podman play kube ~/Projects/unifi-controller/unifi-controller.yml
----
[NOTE]
====
The container will store persistent data in a Podman volume with the same name as the _Persistent Volume Claim_.
====
--
. Access the controller's web console at https://127.0.0.1:8443/.
fish::
+
[source,sh]
----
➜ open http://127.0.0.1:8443
----
Other shells::
+
[source,sh]
----
➜ xdg-open http://127.0.0.1:8443
----
== Automate
Podman makes it extremely easy to set up your pods as systemd services.
It also offers deeper integration with systemd services within the containers themselves.
Follow the instructions here to configure the unifi-controller pod to be managed as a service by systemd and automatically started when your user logs in.
. Create the systemd directory for user units.
+
[source,sh]
----
➜ mkdir -p ~/.config/systemd/user/
----
. Change to this directory.
+
[source,sh]
----
➜ cd ~/.config/systemd/user/
----
. To view your current pods, use the following command.
+
[source,sh]
----
➜ podman pod ps
POD ID NAME STATUS CREATED INFRA ID # OF CONTAINERS
a8a533215a75 unifi-controller Running 47 minutes ago ccf291de56ac 2
----
. Generate the systemd service unit files for the _unifi-controller_ pod with {podman-generate-systemd}.
+
--
Here I generate the actual files using the `--files` option and use the `--name` option to name them using the pod name instead of the hash.
The `--new` option creates a new container when the service starts and destroys the container when it stops.
This option allows Podman to automatically apply updates to the container.
[source,sh]
----
➜ podman generate systemd --files --name --new unifi-controller
/home/jordan/.config/systemd/user/pod-unifi-controller.service
/home/jordan/.config/systemd/user/container-unifi-controller_unifi-controller_1.service
----
--
. Enable the pod's systemd service unit.
+
[source,sh]
----
➜ systemctl --user enable --now pod-unifi-controller.service
Created symlink /home/jordan/.config/systemd/user/multi-user.target.wants/pod-unifi-controller.service → /home/jordan/.config/systemd/user/pod-unifi-controller.service.
Created symlink /home/jordan/.config/systemd/user/default.target.wants/pod-unifi-controller.service → /home/jordan/.config/systemd/user/pod-unifi-controller.service.
----
. Enable automatic updates of the container image.
+
--
Podman ships with both system and user auto-update timers for systemd.
Here I enable the user timer to activate the auto-update service.
The timer is runs daily.
[source,sh]
----
➜ systemctl --user enable --now podman-auto-update.timer
Created symlink /home/jordan/.config/systemd/user/timers.target.wants/podman-auto-update.timer → /usr/lib/systemd/user/podman-auto-update.timer.
----
--
== Contributing
Contributions in the form of issues, feedback, and even pull requests are welcome.
Make sure to adhere to the project's link:CODE_OF_CONDUCT.adoc[Code of Conduct].
== Open Source Software
This project is built on the hard work of countless open source contributors.
Several of these projects are enumerated below.
* https://asciidoctor.org/[Asciidoctor]
* https://www.debian.org/[Debian]
* https://git-scm.com/[Git]
* https://www.linuxfoundation.org/[Linux]
* {Podman}
* https://rouge.jneen.net/[Rouge]
* https://www.ruby-lang.org/en/[Ruby]
* {systemd}
* https://ubuntu.com/[Ubuntu]
== Code of Conduct
The project's Code of Conduct is available in the link:CODE_OF_CONDUCT.adoc[Code of Conduct] file.
== License
This repository is licensed under the https://www.gnu.org/licenses/gpl-3.0.html[GPLv3], available in the link:LICENSE.adoc[license file].
© 2021 Jordan Williams
== Authors
mailto:{email}[{author}]