diff --git a/docs/kubernetes_development.md b/docs/kubernetes_development.md index 3d0484e..b88e1cb 100644 --- a/docs/kubernetes_development.md +++ b/docs/kubernetes_development.md @@ -73,24 +73,23 @@ 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: @@ -98,44 +97,74 @@ spec: 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.