Skip to content

Commit

Permalink
Merge pull request #83 from gervaso/development
Browse files Browse the repository at this point in the history
Add k8s support
  • Loading branch information
bb-Ricardo authored Aug 25, 2021
2 parents 055bddb + 4959798 commit 3b07eba
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,25 @@ docker build -t netbox-sync .
docker run --rm -it -v $(pwd)/settings.ini:/opt/settings.ini netbox-sync [some args...]
```

## Kubernetes

Run the containerized application in a kubernetes cluster

* Build the container image following the docker instructions above
* Tag and push the image to a container registry you have access to
* Create a secret from the settings.ini
* Update the image field in the manifest
* Deploy the manifest to your k8s cluster and check the job is running

```
docker build -t netbox-vsphere-sync .
docker image tag netbox-vsphere-sync your-registry.host/netbox-vsphere-sync:v1.2.0
docker image push your-registry.host/netbox-vsphere-sync:v1.2.0
kubectl create secret generic netbox-vsphere-sync --from-file=settings.ini
kubectl apply -f netbox-vsphere-sync-cronjob.yaml
```

## Accounts and tokens
In order to read data from a vCenter and updated data in NetBox you need credentials in both instances.

Expand Down
25 changes: 25 additions & 0 deletions netbox-vsphere-sync-cronjob.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: netbox-vsphere-sync
labels:
app: netbox-vsphere-sync
spec:
schedule: "10 7-23 * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: netbox-vsphere-sync
image: your.container.registry/netbox-vsphere-sync:v1.2.0
imagePullPolicy: IfNotPresent
volumeMounts:
- name: netbox-vsphere-sync
mountPath: /opt/settings.ini
subPath: settings.ini
volumes:
- name: netbox-vsphere-sync
secret:
secretName: netbox-vsphere-sync
restartPolicy: Never

0 comments on commit 3b07eba

Please sign in to comment.