Control Center in Kubernetes
Create a Kubernetes Project
A Kubernetes project is a Kubernetes namespace with additional configuration properties and enables a community of users to isolate the GridGain Control Center from other applications and users. Additional information on Kubernetes projects can be found here.
-
Create a new Kubernetes project:
kubectl create namespace gridgain-control-center kubectl config set-context --current --namespace=gridgain-control-center
-
Once the project is created, you can perform regular project operations such as
kubectl get namespace
to view the full list of projects andoc status
to view the status of the newly createdgridgain-control-center
project.
Create the Control Center Backend Container
Create the Control Center backend container. Remember to specify the correct image tag for your version of GridGain Control Center.
-
Create the backend container configuration file
control-center-backend-sts.yaml
:# An example of a Kubernetes configuration for Control Center pod deployment. apiVersion: apps/v1 kind: StatefulSet metadata: name: backend namespace: gridgain-control-center spec: replicas: 1 serviceName: backend selector: matchLabels: app: backend template: metadata: labels: app: backend spec: containers: - name: backend-container image: gridgain/control-center-backend:2023.1 imagePullPolicy: IfNotPresent env: - name: JVM_OPTS value: "" volumeMounts: - mountPath: /opt/gridgain-control-center/work name: control-center-storage volumeClaimTemplates: - metadata: name: control-center-storage spec: accessModes: [ "ReadWriteOnce" ] resources: requests: storage: 10Gi
-
Run the following command to create the container:
kubectl apply -f control-center-backend-sts.yaml
Create Control Center Backend Service
Create a Kubernetes service to route network traffic to the Control Center backend. The service will act as a LoadBalancer for the Control Center backend.
-
Create the backend service configuration file
control-center-backend-service.yaml
:apiVersion: v1 kind: Service metadata: name: backend namespace: gridgain-control-center spec: type: LoadBalancer selector: app: backend ports: - name: control-center-web port: 3000 protocol: TCP targetPort: 3000
-
Run the following command to create the service:
kubectl apply -f control-center-backend-service.yaml
Create a ConfigMap for Control Center Frontend
A ConfigMap is a key-value store that lives as a Kubernetes object. ConfigMaps allow you to modify application behavior without having to recreate the Docker image.
Before creating the Control Center frontend container, you must first create the ConfigMap.
-
Create the ConfigMap configuration file
control-center-frontend-configmap.yaml
:apiVersion: v1 kind: ConfigMap metadata: name: control-center-config namespace: gridgain-control-center data: control-center.conf: |- upstream backend-endpoint { server backend:3000; } server { listen 8008; server_name _; set $ignite_console_dir /data/www; root $ignite_console_dir; error_page 500 502 503 504 /50x.html; location / { try_files $uri /index.html = 404; } location /api/v1 { proxy_pass http://backend-endpoint; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Host $http_host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass_header X-XSRF-TOKEN; } location /agents { proxy_pass http://backend-endpoint; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Origin http://backend-endpoint; } location /browsers { proxy_pass http://backend-endpoint; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Origin http://backend-endpoint; proxy_pass_header X-XSRF-TOKEN; } location = /50x.html { root $ignite_console_dir/error_page; } }
-
Apply the Control Center backend configmap to the
gridgain-control-center
project using the following command:kubectl apply -f control-center-frontend-configmap.yaml
Create the Control Center Frontend Container
After the ConfigMap has been applied to the project, create the Control Center frontend container. Remember to specify the correct image tag for your version of GridGain Control Center.
-
Create the container configuration file
control-center-frontend-deployment.yaml
:# An example of a Kubernetes configuration for Control Center deployment. apiVersion: v1 kind: Deployment metadata: name: control-center-frontend namespace: gridgain-control-center labels: app: frontend spec: containers: - name: frontend-container image: gridgain/control-center-frontend:2023.1 imagePullPolicy: IfNotPresent ports: - containerPort: 8008 protocol: TCP volumeMounts: - mountPath: /etc/nginx/control-center.conf name: control-center-config subPath: control-center.conf volumes: - name: control-center-config configMap: name: control-center-config items: - key: control-center.conf path: control-center.conf
-
Run the following command to create the container:
kubectl apply -f control-center-frontend-deployment.yaml
Create Control Center Frontend Service
Create a Kubernetes service to route network traffic to the Control Center frontend service.
-
Create the service configuration file
control-center-frontend-service.yaml
:apiVersion: v1 kind: Service metadata: name: frontend namespace: gridgain-control-center spec: type: LoadBalancer selector: app: frontend ports: - name: control-center-web port: 8008 protocol: TCP targetPort: 8008
-
Run the following command to create the service which will act as a LoadBalancer for the Control Center frontend service:
kubectl apply -f control-center-frontend-service.yaml
Expose the Control Center Frontend Service and Get Routes to the Application
-
Get the deployed Control Center frontend LoadBalancer service IP using the following command:
$ kubectl get svc frontend
-
Finally, access the Control Center frontend UI using one of the returned external IPs.
Creating first Admin account
If this is your first time launching Control Center, you can create an initial Admin account by using details in the Control Center output. Using the example configurations in this document, the default port of the frontend container will be 8008. The Admin creation URL will look like the following:
http://<IP of frontend service>:8008/auth/signup?adminToken=<TOKEN ID as listed in log files>
Connecting a Cluster
When configuring the cluster to connect to Control Center, remember to use the URL to the frontend service with the correct port. In the above examples, the port is 8008. For example:
management.sh -uri http://<frontend.gridgain-control-center>:8008/
Next Steps
-
Connect a GridGain or Apache Ignite Cluster
© 2023 GridGain Systems, Inc. All Rights Reserved. Privacy Policy | Legal Notices. GridGain® is a registered trademark of GridGain Systems, Inc.
Apache, Apache Ignite, the Apache feather and the Apache Ignite logo are either registered trademarks or trademarks of The Apache Software Foundation.