Skip to content

Commit

Permalink
Update dev docs
Browse files Browse the repository at this point in the history
  • Loading branch information
streamer45 committed Jun 30, 2023
1 parent 5bad3cb commit 3b19609
Showing 1 changed file with 46 additions and 17 deletions.
63 changes: 46 additions & 17 deletions docs/kubernetes_development.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,69 +73,98 @@ kubectl apply -f roles.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: calls-offloader
name: calls-offloader-deployment
labels:
app: calls
app.kubernetes.io/name: calls-offloader
spec:
replicas: 1
replicas: 2
selector:
matchLabels:
app: calls
app.kubernetes.io/name: calls-offloader
template:
metadata:
labels:
app: calls
app.kubernetes.io/name: calls-offloader
spec:
serviceAccountName: calls-offloader-service-account
hostNetwork: true # This is needed purely for testing so that it's easier to connect from the local MM instance.
containers:
- name: calls-offloader
image: calls-offloader:master # Testing a local image, should point to the official registry when running in prod.
image: calls-offloader:dev-d94cee0 # Testing a local image, should point to the official registry when running in prod.
ports:
- containerPort: 4545
env:
- name: K8S_NAMESPACE # Forwarding the namespace to be used for creation of new resources.
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: DEV_MODE # This is needed for testing.
- name: DEV_MODE # This is only needed for testing. Should be removed for production use.
value: "true"
- name: LOGGER_ENABLEFILE
value: "false"
- name: JOBS_APITYPE
value: "kubernetes"
- name: API_SECURITY_ALLOWSELFREGISTRATION
- name: JOBS_MAXCONCURRENTJOBS
value: "1"
- name: API_SECURITY_ALLOWSELFREGISTRATION # This should only be set to true if running the service inside a private network.
value: "true"
- name: LOGGER_CONSOLELEVEL
value: "DEBUG"
```

Finally we create the deployment using the YAML file above:
We then create the deployment using the YAML file above:

```sh
kubectl apply -f deployment.yaml
```

### Verify pod is running correctly
### Create service

To verify the deployment is running correctly:
```yaml
apiVersion: v1
kind: Service
metadata:
name: calls-offloader-service
spec:
type: NodePort
selector:
app.kubernetes.io/name: calls-offloader
ports:
- protocol: TCP
port: 4545
targetPort: 4545
nodePort: 30045
```

Finally we create a `NodePort` service to expose the pods to the node:

```sh
kubectl get deployment calls-offloader
kubectl apply -f service.yaml
```

### Verify pods are running correctly

First verify the deployment was created correctly:

```sh
kubectl logs -l app=calls
kubectl get deployment -l app.kubernetes.io/name=calls-offloader
```

### Check pod IP address
Then verify the pods are running by checking the logs:

Finally we find the IP address for the pod to be used from the Calls side to connect to the service (*Job Service URL*):
```sh
kubectl logs -l app.kubernetes.io/name=calls-offloader
```

### Expose service URL

Finally we need to expose the service so that it can be accessed from the host.

```sh
kubectl get pods -l app=calls -o wide
minikube service calls-offloader-service --url
```

The returned URL should be used as the value of the *Job service URL* in the Calls configuration settings.

> **_Note_**
>
> The host's IP (e.g. 192.168.49.1) needs to be configured as *ICE Host Override* on the Calls side to get connectivity to calls from within pod to work.

0 comments on commit 3b19609

Please sign in to comment.