Skip to content

API and Console

Kannika Armory comes with a REST and GraphQL API as well as a web-based user interface called the Console. They provide an easy way to set up and manage your backups, restores and all related resources.

  • The Kannika Armory API and Console are installed

By default, the API and Console are not exposed outside the cluster.

The API and Console can be exposed using the Services available in the system namespace (e.g. kannika-system).

Services
$ kubectl get svc -n kannika-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
api ClusterIP 10.96.124.99 <none> 8080/TCP 1m
console ClusterIP 10.96.46.216 <none> 8080/TCP 1m
...
  • The api Service offers endpoints at /gql and /rest on port 8080 by default.

  • The console Service offers a web-based user interface on port 8080 by default.

For the Console to work properly, it must be able to access the /gql endpoint of the API. The API URL must be configured in the Console configuration of the Helm installation.

values.yaml
console:
config:
apiUrl: "http://localhost:8080" # Do not add /gql

In this example, the Console will access the GraphQL API at https://localhost:8080/gql.

If you want to expose the API and Console locally for testing purposes, you can use kubectl port-forward to forward the ports to your local machine.

Exposing the API on port 8080:

Port
$ kubectl port-forward -n kannika-system svc/api 8080
Forwarding from [127.0.0.1]:8080 -> 8080
Forwarding from [::1]:8080 -> 8080

Exposing the Console on port 8081:

Port
$ kubectl port-forward -n kannika-system svc/console 8080:8081
Forwarding from [127.0.0.1]:8081 -> 8080
Forwarding from [::1]:8081 -> 8080

In this example:

  • Requests to http://localhost:8080/ will be routed to the api Service on port 8080.

  • Requests to http://localhost:8081/ will be routed to the console Service on port 8080.

  • The GraphQL API is available at http://localhost:8080/gql

  • The REST API is available at http://localhost:8080/rest

  • The Console is available at http://localhost:8081. Note that the API URL must be configured for the Console for it to work properly.

It is possible to host the API and Console on the same domain. This is the easiest approach, as it does not require any additional configuration regarding the API URL.

The following example shows how to set up an Ingress to expose the API and Console on the same domain in a standard Kubernetes cluster.

Ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: kannika-ingress
25 collapsed lines
namespace: kannika-system
spec:
defaultBackend:
service:
name: console
port:
number: 8080
rules:
- host: kannika.example.com
http:
paths:
- backend:
service:
name: api
port:
number: 8080
path: /gql
pathType: Prefix
- backend: # Optional if you want to access the REST API
service:
name: api
port:
number: 8080
path: /rest
pathType: Prefix

In this example:

  • The Ingress is named kannika-ingress and is in the kannika-system namespace.

  • Requests to kannika.example.com under the paths /gql and /rest are routed to the api Service on port 8080.

  • The default backend is set to the console Service on port 8080, which means all other requests not matching the paths /gql and /rest under the domain kannika.example.com are routed to the console Service.

  • No additional configuration is needed for the Console to work properly as the API URL is the same as the Console URL.

It is possible to host the API and Console on different domains. This is useful if you want to separate the API and Console for security or organizational reasons.

If the API and Console are hosted on different domains, the API URL must be configured for the Console.

The following example shows how to set up an Ingress to expose the API and Console on different domains in a standard Kubernetes cluster.

Ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: kannika-ingress
29 collapsed lines
namespace: kannika-system
spec:
rules:
- host: api.kannika.example.com
http:
paths:
- backend:
service:
name: api
port:
number: 8080
path: /gql
pathType: Prefix
- backend: # Optional if you want to access the REST API
service:
name: api
port:
number: 8080
path: /rest
pathType: Prefix
- host: console.kannika.example.com
http:
paths:
- backend:
service:
name: console
port:
number: 8080
pathType: Prefix

In this example:

  • The Ingress is named kannika-ingress and is in the kannika-system namespace.

  • Requests to api.kannika.example.com under the paths /gql and /rest are routed to the api Service on port 8080.

  • Requests to console.kannika.example.com are routed to the console Service on port 8080.

  • The Prefix path type is used to match all requests under the specified paths.

Security is enabled by default. For more details about the configuration, check out the Security section.