Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Kubernetes Example Manifests #43

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions examples/kubernetes/00_namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: modbus-proxy
26 changes: 26 additions & 0 deletions examples/kubernetes/10_modbus-proxy.configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Sample configuration file for modbus-proxy
# You can configure multiple proxies for multiple modbus devices.
# The first proxy configuration provides description for all supported options.
# Pass this file location as an --config-file option argument, e.g.:
# $ modbus-proxy --config-file /etc/modbus-proxy.yaml
# See also: systemd modbus-proxy.service example how to run it
# as a systemd service.
#
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: modbus-proxy
name: modbus-proxy-config
namespace: modbus-proxy
data:
#Example config
config.yaml: |
devices:
- modbus: # First proxy configuration
url: modbus.host:502 # modbus connection (the modbus device url)
timeout: 10 # communication timeout [s] (optional, default: 10)
connection_time: 1 # delay after connection [s] (optional, default: 0)
listen: # listen interface
bind: 0:30502 # listening address (mandatory) [IP:port]
# (to which url your clients should connect)
42 changes: 42 additions & 0 deletions examples/kubernetes/20_modbus-proxy-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: modbus-proxy
annotations:
# Optional: trigger config reloader: https://github.com/stakater/Reloader
reloader.stakater.com/auto: "true"
name: modbus-proxy
namespace: modbus-proxy
spec:
replicas: 1
selector:
matchLabels:
app: modbus-proxy
strategy:
type: Recreate
template:
metadata:
labels:
app: modbus-proxy
spec:
terminationGracePeriodSeconds: 1
containers:
- args:
- -c
- /config.yaml
image: quay.io/toschneck/modbus-proxy:2024-09-21
name: modbus-proxy
ports:
- name: modbus-outgoing
containerPort: 30502
protocol: TCP
volumeMounts:
- mountPath: /config.yaml
name: modbus-proxy-config
subPath: config.yaml
restartPolicy: Always
volumes:
- configMap:
name: modbus-proxy-config
name: modbus-proxy-config
18 changes: 18 additions & 0 deletions examples/kubernetes/30_modbus-proxy-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: modbus-proxy
name: modbus-proxy
namespace: modbus-proxy
spec:
type: ClusterIP
ports:
### modbus proxy to mirror traffic from e.g. Huawei pv
- name: modbusproxy
port: 502
protocol: TCP
targetPort: 30502
#nodePort: 30502
selector:
app: modbus-proxy
Loading