---
# System prepended metadata

title: Idface server with ingress.

---


# Idface server with ingress.
The following is an example of a idface-server Deployment. It creates a Deployment, Service and Ingress.

```
---
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
  name: idface-server-deployment
spec:
  selector:
    matchLabels:
      app: idface-server
  replicas: 1 # tells deployment to run 2 pods matching the template
  template:
    metadata:
      labels:
        app: idface-server
    spec:
      containers:
      - name: idface-server
        image: 367672406076.dkr.ecr.eu-central-1.amazonaws.com/facesdk/idface-server:1.13.0
        ports:
        - containerPort: 8080
        env:
        - name: "S3_TOKEN"
          value: "*************************"
        - name: "S3_SECRET"
          value: "************************************"
        - name: "S3_REGION"
          value: "us-east-1"
        - name: "S3_BUCKET"
          value: "myawesomebucket"
        - name: "S3_PATH"
          value: "idface-server"
        - name: "LOGSTASH_HOST"
          value: "elk.example.org"
        - name: "LOGSTASH_PORT"
          value: "5959"
        - name: "SERVER_ALLOW_CORS"
          value: "true"
---
apiVersion: v1
kind: Service
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"idface-server-deployment","namespace":"default"},"spec":{"ports":[{"nodePort":31502,"port":8080,"protocol":"TCP","targetPort":8080}],"selector":{"app":"idface-server"},"sessionAffinity":"None","type":"LoadBalancer"}}
  creationTimestamp: null
  finalizers:
  - service.kubernetes.io/load-balancer-cleanup
  name: idface-server
  selfLink: /api/v1/namespaces/default/services/idface-server-deployment
spec:
  externalTrafficPolicy: Cluster
  ports:
  - nodePort: 31502
    port: 8080
    protocol: TCP
    targetPort: 8080
  selector:
    app: idface-server
  sessionAffinity: None
  type: LoadBalancer
status:
  loadBalancer: {}
--- ###### Ingress configuration #######
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: idface-server-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
    - host: idface-server-example.idrnd.net
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: idface-server
                port:
                  number: 8080

```
Apply it:
```
kubectl apply -f idface-server-deployment.yml -n idface-server
```
After that you can access idface-server endpoint using Service:
```
#kubectl get svc -n idface-server
NAME            TYPE           CLUSTER-IP      EXTERNAL-IP                                                               PORT(S)          AGE
idface-server   LoadBalancer   172.20.55.109   a306ce489931845e78315a29b56a740d-1569925746.us-west-1.elb.amazonaws.com   8080:31502/TCP   19m

# Test it:
#curl a306ce489931845e78315a29b56a740d-1569925746.us-west-1.elb.amazonaws.com:8080/api_version
{"product":"IDFace-Server","version":"1.13.0"}%
```
And using Ingress:
```
#kubectl get ing -n idface-server
NAME                    CLASS    HOSTS                             ADDRESS                                                                  PORTS   AGE
idface-server-ingress   <none>   idface-server-example.idrnd.net   a27b30748c9144b55a1861ba451f74f1-518158292.us-west-1.elb.amazonaws.com   80      36s

# Test it:
# curl -H "Host: idface-server-example.idrnd.net" a27b30748c9144b55a1861ba451f74f1-518158292.us-west-1.elb.amazonaws.com/api_version
{"product":"IDFace-Server","version":"1.13.0"}%
```