Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

If you do not have a valid HiveMQ license, the HiveMQ cluster uses a trial licence that allows up to 25 concurrent client connections and is limited to testing and evaluation purposes only. To obtain a HiveMQ licence that is suitable for production use, or request an evaluation licence that allows more connections, contact our customer service team.

While creating this guide, our Kubernetes Version is v1.27.9, it might be different in your case

Requirements

  • Amazon Account

  • HiveMQ License (optional)

  • Amazon CLI installed and configured

    • The AWS Command Line Interface is an open-source tool that enables you to interact with AWS services using commands in your command-line shell.
      To install the AWS CLI on macOS with Homebrew, open a terminal and enter the following. For other operating systems, see AWS CLI installation.

      brew install awscli
    • Verify AWS CLI Installation Open a new terminal or command prompt and run:

      • This should display the installed AWS CLI version.

        aws --version
    • After installing the AWS CLI, do the following steps to configure it. For more information, see Configure the AWS CLI in the AWS Command Line Interface User Guide.

    • AWS IAM User: You can also create IAM user from AWS Management console. For this procedure, we are creating an IAM user using AWS CLI.
      You can skip the following steps if you already have a IAM user with the right access.

      • Create a New IAM User

        Run the following command to create a new IAM user:

        aws iam create-user --user-name hivemq-user
      • Attach AdministratorAccess Policy

        Run the following command to attach the AdministratorAccess policy to the newly created user:

        aws iam attach-user-policy --user-name hivemq-user --policy-arn arn:aws:iam::aws:policy/AdministratorAccess
      • Create Access Key

        Run the following command to create an access key for the user:

        aws iam create-access-key --user-name hivemq-user

        Following is the output is displayed after the successful creation of the access key, Please copy AccessKeyId and SecretAccessKey values for the next steps.

        {
            "AccessKey": {
                "UserName": "test-user",
                "AccessKeyId": "AKIAZDMBWNVEP3Y5F2PH",
                "Status": "Active",
                "SecretAccessKey": "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",
                "CreateDate": "2024-02-01T11:10:59+00:00"
            }
        }
      • Run the following command:

        aws configure
      • Optionally, you can configure a named profile, such as --profile cluster-admin. If you configure a named profile in the AWS CLI, you must always pass this flag in subsequent commands.
        This command will prompt you to enter the following information:

        • AWS Access Key ID: Enter your AWS access key.

        • AWS Secret Access Key: Enter your AWS secret key.

        • Default region name: Enter the AWS region you want to use (e.g., us-east-1).

        • Default output format: You can leave this as json.
          For example:

          AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
          AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
          Default region name [None]: us-east-1
          Default output format [None]: json
  • EKS CLI (eksctl)
    eksctl is a command line tool for working with EKS clusters that automates many individual tasks. To install the AWS CLI on macOS with Homebrew, open a terminal and enter the following. For other operating systems, see the installation in eksctl documentation.

    brew tap weaveworks/tap
    brew install weaveworks/tap/eksctl
  • IAM permissions – The IAM security principal that you're using must have permissions to work with Amazon EKS IAM roles, service linked roles, AWS CloudFormation, a VPC, and related resources. For more information, see Actions, resources, and condition keys for Amazon Elastic Container Service for Kubernetes and Using service-linked roles in the IAM User Guide.

  • Kubectl, Helm and MQTT CLI https://hivemq.atlassian.net/wiki/spaces/HMS/pages/2700902571

Set Up Your Kubernetes Cluster With Elastic Kubernetes Service (EKS)

  1. To create an EKS cluster with all the necessary resources for your cluster, enter the following command with the desired location (in this procedure, we use eu-west-1) and instance type c5.2xlarge (8 CPUs, 16 GiB RAM), enter the following command and wait until the process completes. Processing time can vary:

eksctl create cluster \
  --name HiveMQCluster \
  --region eu-west-1 \
  --node-type c5.2xlarge \
  --version 1.27 \
  --nodes 4

Above command will also create IAM role and required permissions for eksctl.

Your AWS account bills you for all resources you create.

Manage the cluster

  1. To manage the resulting Kubernetes cluster with kubectl, download the access credentials of the cluster:

    aws eks --region eu-west-1 update-kubeconfig --name HiveMQCluster
  2. To verify that all three nodes are available, enter:

    kubectl get nodes
  3. The output from the command is similar to the following: (k8s v1.27.9 in our case, it might be different for you)

NAME                                STATUS   ROLES   AGE     VERSION
ip-192-168-17-91.eu-west-1.compute.internal    Ready    <none>   171m   v1.27.9-eks-5e0fdde
ip-192-168-42-23.eu-west-1.compute.internal    Ready    <none>   171m   v1.27.9-eks-5e0fdde
ip-192-168-80-191.eu-west-1.compute.internal   Ready    <none>   171m   v1.27.9-eks-5e0fdde
ip-192-168-60-151.eu-west-1.compute.internal   Ready    <none>   171m   v1.27.9-eks-5e0fdde

In case you do not see the right nodes, please check and fix the current context

  1. Check the current context, this should be set to HiveMQCluster in this case
    kubectl config current-context

  2. Fix the context
    kubectl config use-context HiveMQCluster

Delete Cluster

If you do not need your cluster anymore, please use the following commands to delete the cluster.

  1. List all services running in your cluster.

    kubectl get svc --all-namespaces
  2. Delete any services that have an associated EXTERNAL-IP value. These services are fronted by an Elastic Load Balancing load balancer, and you must delete them in Kubernetes to allow the load balancer and associated resources to be properly released.

    kubectl delete svc service-name
  3. Delete the cluster and its associated nodes with the following command,

    eksctl delete cluster --name HiveMQCluster  --region eu-west-1

Next steps

https://hivemq.atlassian.net/wiki/spaces/HMS/pages/2691039283

  • No labels