Quick Example showing an OPC Publisher on K8s
- Azure Cli
- kubectl
- Edit the json file to reflect your desired config under config/pn-opcpubdemo.json.
- Create NS
kubectl create ns opc
- (Optional) to save you typing in --namespace opc you can switch your k8s context to be here permanently
kubectl config set-context --current --namespace=opc
- (Optional) to save you typing in --namespace opc you can switch your k8s context to be here permanently
- Create ConfigMap from the json config file
kubectl create configmap opc-configmap --from-file=config/pn-opcpubdemo.json --namespace opc
- Create and Get the Secret from your IOT Hub Config:
- (Optional) Create the Device:
az iot hub device-identity create --device-id opcpubdemo --hub-name **YOURHUBNAMEHERE**
- Retrieve the Device Connstring and pipe to file for secret creation:
az iot hub device-identity connection-string show --device-id opcpubdemo --query connectionString --hub-name **YOURHUBNAMEHERE** -o tsv > connstring.txt
- (Optional) Create the Device:
- Replace MYSECRET with the connstring from above in secret.yaml
- Deploy Secret
kubectl apply -f secret.yaml
- Create PVC (Persistent Volume Claim)
kubectl apply -f pvc.yaml
- Deploy Pod
kubectl apply -f deployment.yaml