feat: add support for running neolink in k8s. add related documentation.
This commit is contained in:
1 parent
4a94a2ddb2
commit
b13db1227d
2 files changed
+222
No files matched your search
@@ -0,0 +1,50 @@
|
||||
### Neolink in Kubernetes
|
||||
|
||||
#### Introduction
|
||||
|
||||
This README provides guidance on deploying the NeoLink application on Kubernetes using the provided manifest files. The deployment is designed to set up a NeoLink application within its own namespace, with a specific configuration for node affinity, resource limits, and service exposure.
|
||||
|
||||
#### Prerequisites
|
||||
|
||||
- Kubernetes Cluster
|
||||
- Command-line tool (kubectl)
|
||||
- Basic understanding of Kubernetes concepts (Pods, Services, Deployments, ConfigMaps)
|
||||
|
||||
#### Deployment Overview
|
||||
|
||||
The deployment consists of four main parts:
|
||||
|
||||
1. Namespace Creation: A new namespace neolink is created to isolate the resources.
|
||||
|
||||
2. Deployment Configuration: The neolink-app-deployment is set up with:
|
||||
- A single replica.
|
||||
- Affinity to arm64 nodes (Though this is optional).
|
||||
- Resource limits and requests for CPU and memory.
|
||||
- A custom command and args to use a specific configuration file.
|
||||
|
||||
3. Service Exposure: A LoadBalancer type service named neolink exposes the application on port 8554.
|
||||
|
||||
4. ConfigMap: Contains the application configuration neolink.toml.
|
||||
|
||||
#### Steps to Deploy
|
||||
|
||||
```bash
|
||||
kubectl apply -f manifest.yaml
|
||||
```
|
||||
|
||||
### Configuration Details
|
||||
|
||||
- The neolink.toml file in the ConfigMap provides the application configuration. Customize it as per your requirements.
|
||||
- The deployment is set to favor arm64 architecture nodes via a `nodeAffinity`. This is a personal preference as in my cluster all my raspberrpis (except one) run 32bit raspian OS. And to try and get more bang for my buck I was to run neolink on my arm64 8Gb node. Again, this is totaly optional for you.
|
||||
- Resource limits are set to ensure efficient use of cluster resources.
|
||||
- The LoadBalancer service will make the application accessible externally.
|
||||
|
||||
#### Troubleshooting
|
||||
|
||||
- If the pod fails to start, check the pod logs and describe the pod for more details.
|
||||
- Ensure that the arm64 node is available and schedulable in your cluster (if you're using nodeAffinity).
|
||||
- Verify that the ConfigMap is correctly applied and mounted.
|
||||
|
||||
#### Conclusion
|
||||
|
||||
This guide provides a step-by-step approach to deploying the NeoLink application on a Kubernetes cluster. Modify the manifests as necessary to fit your specific requirements and environment.
|
||||
@@ -0,0 +1,172 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: neolink
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: neolink-app-deployment
|
||||
namespace: neolink
|
||||
labels:
|
||||
app: neolink
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: neolink
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: neolink
|
||||
spec:
|
||||
containers:
|
||||
- name: neolink
|
||||
image: quantumentangledandy/neolink
|
||||
ports:
|
||||
- containerPort: 8554
|
||||
command: ["/bin/sh", "-c"]
|
||||
args: ["cp /config/neolink.toml /etc/neolink.toml && /usr/local/bin/neolink rtsp --config /etc/neolink.toml"]
|
||||
volumeMounts:
|
||||
- name: config-volume
|
||||
mountPath: /config
|
||||
resources:
|
||||
limits:
|
||||
memory: "600Mi"
|
||||
cpu: "300m"
|
||||
requests:
|
||||
memory: "200Mi"
|
||||
cpu: "150m"
|
||||
volumes:
|
||||
- name: config-volume
|
||||
configMap:
|
||||
name: default-config
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: neolink
|
||||
name: neolink
|
||||
namespace: neolink
|
||||
spec:
|
||||
ports:
|
||||
- name: tcp-interface-neolink
|
||||
port: 8554
|
||||
protocol: TCP
|
||||
targetPort: 8554
|
||||
selector:
|
||||
app: neolink
|
||||
type: LoadBalancer
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: default-config
|
||||
namespace: neolink
|
||||
data:
|
||||
neolink.toml: |
|
||||
# A bind value of 0.0.0.0 means any network this computer can access
|
||||
# You can chage this to a specfic network e.g. "192.168.1.101" here
|
||||
# Or to no networks e.g. this computer only "127.0.0.1"
|
||||
bind = "0.0.0.0"
|
||||
|
||||
# Default port is 8554 but you can change it by uncommenting the following
|
||||
# bind_port = 8554
|
||||
|
||||
# Uncomment the following and supply a path to a valid PEM
|
||||
# to activate TLS encryption.
|
||||
# The PEM should contain the certificate and the private key
|
||||
# If TLS is activated you must connect with "rtsps://" and not "rtsp://"
|
||||
# certificate = "/path/to/pem/with/cert/and/key"
|
||||
|
||||
# Choose if the client is required to provide a certificate signed by the server's CA.
|
||||
# none|requested|required - default none
|
||||
# tls_client_auth = "required"
|
||||
|
||||
# You can password protect the rtsp server mount points by adding users
|
||||
# like the following me and someone. If you do not add [[users]]
|
||||
# then anyone can connect without a password or username
|
||||
# To access such a stream try using a url such as "rtsp://me:mepass@192.168.1.101/driveway"
|
||||
|
||||
# [[users]]
|
||||
# name = "me"
|
||||
# pass = "mepass"
|
||||
#
|
||||
# [[users]]
|
||||
# name = "someone"
|
||||
# pass = "someonepass"
|
||||
|
||||
# Uncomment to enable MQTT
|
||||
#[mqtt]
|
||||
# mqtt.broker_addr = "192.168.1.122"
|
||||
# mqtt.port = 1883
|
||||
# mqtt.credentials = ["mqtt_user", "mqtt_password"]
|
||||
|
||||
|
||||
[[cameras]]
|
||||
name = "driveway"
|
||||
username = "admin"
|
||||
password = "12345678"
|
||||
address = "192.168.1.187:9000"
|
||||
# MQTT Discovery: https://www.home-assistant.io/integrations/mqtt/#mqtt-discovery
|
||||
# mqtt.discovery.topic = "homeassistant" # Uncomment to enable
|
||||
# If using discovery, _ characters are replaced with spaces in the name and title case is applied
|
||||
# mqtt.discovery.features = ["floodlight"] # Uncomment if this camera has a spotlight/floodlight
|
||||
|
||||
# If you use a battery camera: **Instead** of an `address` supply the uid
|
||||
# as follows
|
||||
# uid = "ABCD01234567890EFG"
|
||||
|
||||
# By default any of the users can connect (or anyone at all if no users are specfied)
|
||||
# You can uncomment the following to permit only specfic users
|
||||
# permitted_users = [ "me" ]
|
||||
|
||||
# By default "both" "mainStream" and "subStream" are connected
|
||||
# If your device has user connection limits try a single stream instead.
|
||||
# stream = "mainStream"
|
||||
|
||||
# By default neolink will use any means to connect to the camera
|
||||
# from a UID
|
||||
# This include relaying via reolink servers
|
||||
# This variable `discovery` controls the method of UID discovery
|
||||
# - Possible values
|
||||
# "relay" # Any means including connecting and transmitting through reolink
|
||||
# "map" # Register our local ip address with reolink and ask the camera to connect to us but don't relay data through reolink
|
||||
# "remote" # Register our local ip address with reolink but only permit same network connections (useful if broadcast is not possible)
|
||||
# "local" # Do not contact reolink servers at all. Rely soley on local UDP broadcast based discovery
|
||||
#
|
||||
# "cellular" # Cellular camera only support Relay and Map to speed up connecting to them this option will skip the local/remote
|
||||
#
|
||||
# discovery = "relay"
|
||||
|
||||
# Certain types of camera emit status messages (such as battery levels)
|
||||
#
|
||||
# By default we hide these status messages from the user but you can instead requst that
|
||||
# they be printed to stdout using print_format
|
||||
#
|
||||
# Valid values are:
|
||||
# - None
|
||||
# - Human
|
||||
# - Xml
|
||||
#
|
||||
# print_format = "None"
|
||||
|
||||
|
||||
[[cameras]]
|
||||
name = "storage shed"
|
||||
username = "admin"
|
||||
password = "987654321"
|
||||
address = "192.168.1.245:9000"
|
||||
# If you use a battery camera: **Instead** of an `address` supply the uid
|
||||
# as follows
|
||||
# uid = "ABCD01234567890EFG"
|
||||
|
||||
# If you use an NVR that relays several camera connections you can choose which
|
||||
# camera to connect to with by setting the `channel_id`
|
||||
#
|
||||
# By default channel_id = 0. Eg the first connected camera on the device
|
||||
# **Note**: that unlike in the offical client the numbering starts from 0 not 1.
|
||||
# An 8 channel NVR would have channels 0 through 7
|
||||
# channel_id = 0
|
||||
Reference in new issue
Block a user