This project is used for hands-on exercises of the Apache Ignite and Kubernetes: Deployment and Orchestration Strategies training course. That's a free two-hour training session for developers, architects, and DevOps engineers who need to deploy and orchestrate Apache Ignite in a Kubernetes environment.
Check the schedule a join one of our upcoming sessions. All the courses are delivered by seasoned Ignite community members.
This project uses GridGain Community Edition version 8.8.27
- Install Docker Desktop and
kubectl
tool. We tested with version 4.18.0. - Enable Kubernetes in Docker Desktop's settings
- Java Developer Kit, version 11 or later
- Apache Maven 3.0 or later
- Your favorite IDE, such as IntelliJ IDEA, or Eclipse, or a simple text editor.
- Clone this project or download it as an archive:
git clone https://github.com/GridGain-Demos/ignite-kubernetes-essentials-training.git
- Change into dashboard directory
cd {project_root}/ignite-kubernetes-essentials-training/k8dashboard
- Apply the Metrics Server configuration
kubectl apply -f metrics-server.yaml
- Apply the Dashboard configuration
kubectl apply -f k8ui.yaml
- Create the Service Account
kubectl apply -f service-account.yaml
- Apply the Cluster Role Binding
kubectl apply -f cluster-role-binding.yaml
- Create token
kubectl -n kubernetes-dashboard create token admin-user
- Run the proxy
kubectl proxy
- Open Dashboard in browser http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/login
- Paste the token you got in 4.
Start the Ignite Kubernetes Service that is used inter-node communication needs:
-
Navigate to the project's config folder:
cd {project_root}/ignite-kubernetes-essentials-training/config
-
Create a namespace for the training course:
kubectl create namespace ignite-namespace
-
Start the Ignite Kubernetes service
kubectl create -f ignite-service.yaml
-
Confirm the service is running:
kubectl get services -n ignite-namespace
Next, create a Cluster Role and Service Accounts:
- Create a service account:
kubectl create sa ignite -n ignite-namespace
- Create a Cluster Role:
kubectl create -f cluster-role.yaml
-
Create a ConfigMap with persistent configuration:
kubectl create configmap ignite-cfg-persistent -n ignite-namespace --from-file=persistent/ignite-node-cfg.xml
-
Start the cluster:
kubectl create -f persistent/ignite-cluster.yaml
-
Confirm the Ignite pods are running:
kubectl get pods -n ignite-namespace
-
Double check with Ignite logs that a 2-node cluster was created:
kubectl logs ignite-cluster-0 -n ignite-namespace
-
Attach your cluster to GridGain Control Center by going to
https://portal.gridgain.com/
and providing the cluster's token ID from the logs. -
Active the persistent cluster with Control Center
https://portal.gridgain.com/clusters/list
- Connect to the first cluster pod via bash:
kubectl exec --stdin --tty ignite-cluster-0 -n ignite-namespace -- /bin/bash
- Go to the
bin
folder:cd bin/
- Connect to the cluster via SQLLine tool:
./sqlline.sh -u jdbc:ignite:thin://127.0.0.1/
- Load the World database:
!run ../examples/sql/world.sql
- Quit from SQLLine:
!q
- Quit from bash:
exit
- Refresh the
Storage Metrics
dashboard on the Control Center side to confirm that the data was loaded.
In this section, you're connecting to the K8 Ignite cluster with external APIs and applications (those that are not deployed in the same K8 environment).
-
Open up your preferred browser and check the cluster state via the Ignite REST API:
http://localhost:8080/ignite?cmd=state
Note, the
localhost
is theexternal-IP
of the Ignite Kubernetes Service. -
Select the count of Cities:
http://localhost:8080/ignite?cmd=qryfldexe&pageSize=10&cacheName=City&qry=SELECT%20count(*)%20From%20City
Note, on Windows workstation due to Hyper-V or WSL above port 8080 may be blocked. A workaround is to install k8slens and it will create a port forwarding to 8080 via a local_port on localhost. Then invoke the Ignite REST API as http://localhost:<local_port>/ignite?cmd=......
- Build the project
mvn clean package
- Execute the thin client class
java -cp target/ignite-kubernetes-essentials-training-1.0-SNAPSHOT.jar com.gridgain.example.SampleThinClient
Note, the thin client tries to connect to your Ignite cluster on 10800 port. On Windows workstation that port is not automatically selected and so in k8slens create a port forwarding to 10800 by setting local_port to 10800 on localhost.
- Create the Docker image
docker build -t ignite-thick-client .
-
Create the client Kubernetes Service
kubectl apply -f config/ignite-client-service.yaml
-
Create the thick client pods
kubectl apply -f config/thick-client.yaml
- Open up your preferred browser and check the REST API:
http://localhost:8088/cities
Note, as was the case in Ignite REST API above, on Windows workstation due to Hyper-V or WSL above port 8088 may be blocked. Use k8slens to create a port forwarding to 8080 via a local_port on localhost. Then invoke the Ignite REST API as http://localhost:<local_port>/cities
- Remove all the resources associated with this project:
kubectl delete namespace ignite-namespace
- Remove the ClusterRole:
kubectl delete clusterrole ignite -n ignite-namespace
- Remove the ClusterRole binding:
kubectl delete clusterrolebinding ignite -n ignite-namespace
Note, use this command if the termination of an Ignite pod is stuck:
kubectl delete pod ignite-cluster-1 --grace-period=0 --force -n ignite-namespace