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.
Prerequisites
- The Kannika Armory API and Console are installed
Exposing the API and Console
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).
$ kubectl get svc -n kannika-systemNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGEapi ClusterIP 10.96.124.99 <none> 8080/TCP 1mconsole ClusterIP 10.96.46.216 <none> 8080/TCP 1m...-
The
apiService offers endpoints at/gqland/reston port8080by default. -
The
consoleService offers a web-based user interface on port8080by default.
Configuring the API URL for the Console
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.
console: config: apiUrl: "http://localhost:8080" # Do not add /gqlIn this example, the Console will access the GraphQL API at https://localhost:8080/gql.
Exposing locally
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:
$ kubectl port-forward -n kannika-system svc/api 8080Forwarding from [127.0.0.1]:8080 -> 8080Forwarding from [::1]:8080 -> 8080Exposing the Console on port 8081:
$ kubectl port-forward -n kannika-system svc/console 8080:8081Forwarding from [127.0.0.1]:8081 -> 8080Forwarding from [::1]:8081 -> 8080In this example:
-
Requests to
http://localhost:8080/will be routed to theapiService on port8080. -
Requests to
http://localhost:8081/will be routed to theconsoleService on port8080. -
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.
Hosting on the same domain
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.
apiVersion: networking.k8s.io/v1kind: Ingressmetadata: name: kannika-ingress25 collapsed lines
namespace: kannika-systemspec: 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: PrefixIn this example:
-
The Ingress is named
kannika-ingressand is in thekannika-systemnamespace. -
Requests to
kannika.example.comunder the paths/gqland/restare routed to theapiService on port8080. -
The default backend is set to the
consoleService on port8080, which means all other requests not matching the paths/gqland/restunder the domainkannika.example.comare routed to theconsoleService. -
No additional configuration is needed for the Console to work properly as the API URL is the same as the Console URL.
Hosting on different domains
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.
apiVersion: networking.k8s.io/v1kind: Ingressmetadata: name: kannika-ingress29 collapsed lines
namespace: kannika-systemspec: 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: PrefixIn this example:
-
The Ingress is named
kannika-ingressand is in thekannika-systemnamespace. -
Requests to
api.kannika.example.comunder the paths/gqland/restare routed to theapiService on port8080. -
Requests to
console.kannika.example.comare routed to theconsoleService on port8080. -
The
Prefixpath type is used to match all requests under the specified paths.
Security
Security is enabled by default. For more details about the configuration, check out the Security section.