Kubernetes Deployments
You can create a Control Hub Kubernetes deployment for an active Kubernetes environment.
When you create the deployment, you define the engine type, version, and configuration to deploy to the Kubernetes cluster. Each engine instance runs in a dedicated Kubernetes pod. You also configure details about the pods, including whether the number of pods are automatically scaled during times of peak performance or whether a fixed number of pods are created.
If you are an advanced Kubernetes user, you can use advanced mode to directly edit the deployment YAML file.
When you start a Control Hub Kubernetes deployment, the IBM StreamSets Kubernetes agent that corresponds to the parent environment creates a YAML file describing the required resources. The YAML file creates a single Kubernetes deployment and secret in the Kubernetes namespace. The YAML file also creates a horizontal pod autoscaler if the Control Hub deployment is configured to allow autoscaling. The Kubernetes deployment then creates a replica set to ensure that enough pods are created, with each pod running a single engine instance.
Kubernetes manages the provisioning and monitoring of the pods. The agent simply receives the status of the deployed engine instances, and communicates the status to Control Hub.
When you stop a Control Hub Kubernetes deployment, all Kubernetes resources created for that deployment are deleted.
Before you create a Control Hub Kubernetes deployment, you must complete several prerequisites.
Secrets
- Authentication token that the deployment uses to communicate with IBM StreamSets.
- Proxy credentials, including the HTTP and HTTPS proxy user and password, when you configure engines to use a proxy server.
Prerequisites
- Create a Kubernetes environment
- Create and activate a Control Hub Kubernetes environment and launch an IBM StreamSets Kubernetes agent for that environment, as described in Kubernetes Environments.
- Optionally, create a Kubernetes service account
- By default, each Kubernetes deployment provisioned in the Kubernetes namespace uses the default service account configured for the namespace. If you require a specific service account for this deployment, ask your Kubernetes administrator to create a service account.
- Optionally, set up an external resource archive
- When your pipelines require external resources and when you plan to deploy multiple engine instances, you must set up an external resource archive that all engine instances can access. When your pipelines do not require external resources or when using a single engine instance to get started with IBM StreamSets, you do not need to complete this prerequisite.
Configuring a Kubernetes Deployment
Configure a Control Hub Kubernetes deployment to define the group of engine instances to deploy to a Kubernetes environment.
To create a new deployment, click Create Deployment icon: .
in the Navigation panel, and then click theTo edit an existing deployment, click Edit.
in the Navigation panel, click the deployment name, and then clickDefine the Deployment
Define the deployment essentials, including the deployment name and type, the environment that the deployment belongs to, and the engine type and version to deploy.
Once saved, you cannot change the deployment type, the engine version, or the environment.
-
Configure the following properties:
Define Deployment Property Description Deployment Name Name of the deployment. Use a brief name that informs your team of the deployment use case.
Deployment Type Select Kubernetes. Environment Active Kubernetes environment where engine instances will be deployed. Engine Type Type of engine to deploy: - Data Collector
- Transformer
Engine Version Engine version to deploy. Deployment Tags Optional tags that identify similar deployments within Control Hub. Use deployment tags to easily search and filter deployments. Enter nested tags using the following format:
<tag1>/<tag2>/<tag3>
-
If creating the deployment, click one of the following buttons:
- Cancel - Cancels creating the deployment and exits the wizard.
- Save & Next - Saves the deployment and continues.
- Save & Exit - Saves the deployment and exits the wizard, displaying the incomplete deployment in the Deployments view.
Configure the Engine
Define the configuration of the engine to deploy. You can use the defaults to get started.
-
Configure the following properties:
Engine Property Description Stage Libraries Stage libraries to install on the engine.
The available stage libraries depend on the selected engine type and version.
Advanced Configuration Access to advanced configuration properties to further customize the engine. As you get started with StreamSets, the default values should work in most cases.
The available properties depend on the selected engine type.
External Resource Source Source of the external files and libraries, such as JDBC drivers, required by the engine: - None - External resources are not defined in the
deployment.
Select when using a single engine instance to get started with IBM StreamSets, or when your pipelines do not require external resources.
- Archive File - External resources are included in an
archive file defined in the deployment.
Select when the deployment launches multiple engine instances and when your pipelines require external resources.
External Resource Location Location of the archive file that contains the external resources used by the engine. The archive file must be in TGZ or ZIP format.
Enter the location using one of the following formats:- File path. For example:
/mnt/shared/externalResources.tgzImportant: To use a file path, you must use advanced mode to edit the deployment YAML file to mount the file to the engine container.
- URL. For example: https://<hostname>:<port>/shared/externalResources.tgz
Tip: Click the download icon to download a sample externalResources.tgz file to view the required directory structure.Available when using an archive file as the source for external resources.
Engine Labels Labels to assign to all engine instances launched for this deployment. Labels determine the group of engine instances that run a job. Default is the name of the deployment.
Max CPU Load (%) Maximum percentage of CPU on the host machine that an engine instance can use. When an engine equals or exceeds this threshold, Control Hub does not start new pipeline instances on the engine.
All engine instances belonging to the deployment inherit these resource threshold values.
Default is 80.
Max Memory (%) Maximum percentage of the configured Java heap size that an engine instance can use. When an engine equals or exceeds this threshold, Control Hub does not start new pipeline instances on the engine.
Default is 100.
Max Running Pipeline Count Maximum number of pipelines that can be running on each engine instance. When an engine equals this threshold, Control Hub does not start new pipeline instances on the engine.
Default is 1,000,000.
- None - External resources are not defined in the
deployment.
-
If creating the deployment, click one of the following buttons:
- Back - Returns to the previous step in the wizard.
- Save & Next - Saves the deployment and continues.
- Save & Exit - Saves the deployment and exits the wizard, displaying the incomplete deployment in the Deployments view.
Configure the Kubernetes Deployment
Configure details about the pods provisioned in the Kubernetes cluster.
-
If you are an advanced Kubernetes user and want to directly edit the deployment
YAML, select Advanced Mode.
Note: As you configure the deployment, Control Hub generates a valid YAML file used to provision the Kubernetes resources. The automatically-generated YAML file is sufficient for most use cases.
For details about using advanced mode, see Advanced Mode.
-
Configure the following properties:
Kubernetes Deployment Property Description Kubernetes Labels Kubernetes labels to apply to all Kubernetes resources provisioned for this deployment. Enter the labels as key-value pairs. For label naming requirements, see the Kubernetes documentation.Important: IBM StreamSets reservesapp
as a label key for its own use. As a result, you cannot defineapp
as a label key.You can define the labels using simple or bulk edit mode. In simple edit mode, click Add Another to define additional labels. In bulk edit mode, configure labels in JSON format.
Note: These labels are applied to Kubernetes resources, not to Control Hub deployments.Enable Autoscaling Automatically scale the number of engine instances during times of peak performance. Enable only when your Kubernetes administrator has set up a metrics server as an environment prerequisite. For each instance, Kubernetes creates a replicated pod, and then deploys and launches a single engine instance to each pod.
Important: If your pipelines require external resources, you must set up an external resource archive that all engine instances can access before increasing the number of instances.When enabled, configure the minimum and maximum number of instances to deploy. In addition, you must configure the CPU Requested or CPU Limit property, or both properties.
Note: If you edit an active Kubernetes deployment to enable autoscaling, Kubernetes initially decreases the number of pods to one until it can create a horizontal pod autoscaler, which can take several minutes.Desired Instances Number of engine instances to deploy. For each instance, Kubernetes creates a replicated pod, and then deploys and launches a single engine instance to each pod.Important: If your pipelines require external resources, you must set up an external resource archive that all engine instances can access before increasing the number of instances.Default is 1. Set to the minimum value of 0 to temporarily prevent engine instances from running, as an alternative to stopping the deployment but that still incurs minimal costs from the cloud service provider.
Available when autoscaling is disabled.
Minimum Instances Minimum number of engine instances to deploy. Minimum value is 1.
Available when autoscaling is enabled.
Maximum Instances Maximum number of engine instances to deploy. Available when autoscaling is enabled.
CPU Threshold Percentage Target average CPU utilization, represented as a percentage of the requested CPU, over all pods hosting an engine instance. For example, if CPU Requested is 100m, and CPU Threshold Percentage is 50%, Kubernetes creates additional pods hosting engine instances when the average CPU usage for all existing pods exceeds 50%. Kubernetes removes pods when the average CPU usage falls below 50%.Note: To maintain stability, Kubernetes does not immediately increase or decrease pods when the average CPU usage exceeds or falls below the threshold. Instead, it waits for some time before making changes.Available when autoscaling is enabled.
CPU Requested Requested amount of CPU for each pod hosting an engine instance. A pod is guaranteed to have as much CPU as it requests.
CPU Limit Maximum amount of CPU that each pod hosting an engine instance can use. Memory Requested Requested amount of memory for each pod hosting an engine instance. Include the units when you enter a value. For example, enter
1024Mi
to specify 1024 mebibytes. For more information about Kubernetes memory resource units, see the Kubernetes documentation.A pod is guaranteed to have as much memory as it requests.
Memory Limit Maximum amount of memory in megabytes that each pod hosting an engine instance can use. Service Account Name Name of the Kubernetes service account to associate with the Kubernetes deployment provisioned in the namespace. Specify when your Kubernetes administrator has created a service account as a prerequisite. When not specified, the default service account configured for the namespace is used.
-
If creating the deployment, click one of the following buttons:
- Back - Returns to the previous step in the wizard.
- Save & Next - Saves the deployment and continues.
- Save & Exit - Saves the deployment and exits the wizard, displaying the incomplete deployment in the Deployments view.
Share the Deployment
By default, the deployment can only be seen by you. Share the deployment with other users and groups to grant them access to it.
- In the Select Users and Groups field, type a user email address or a group name.
-
Select users or groups from the list, and then click
Add.
The added users and groups display in the User / Group table.
-
Modify permissions as needed. By default, each added user
or group is granted the following permissions:
- Read - View the details of the deployment and of all engines managed by the deployment. Restart or shut down individual engines managed by the deployment in the Engines view.
- Write - Edit, start, stop, and delete the deployment. Delete engines managed by the deployment. Also requires read access on the parent environment.
- Execute - Start jobs on engines managed by the deployment. Starting jobs also requires execute access on the job and read access on the pipeline.
For more information, see Deployment Permissions.
-
Click one of the following buttons:
- Back - Returns to the previous step in the wizard.
- Save & Next - Saves the deployment and continues.
- Save & Exit - Saves the deployment and exits the wizard, displaying the incomplete deployment in the Deployments view.
Review and Launch the Deployment
You've successfully finished creating the deployment.
-
Click one of the following buttons:
- Exit - Saves the deployment and exits the wizard, displaying the Deactivated deployment in the Deployments view. You can start the deployment at a later time.
- Launch Deployment - Starts the deployment, as
long as the IBM StreamSets Kubernetes agent that corresponds to the parent environment is online.
The agent communicates with Control Hub
to provision the Kubernetes resources needed to run engines and to deploy engine
instances to those resources. Note: In some cases, Kubernetes can take several minutes to create and run all resources. A Control Hub Kubernetes deployment transitions to an Active state only when all associated Kubernetes resources are running.
-
If the deployment launches a Transformer engine that works with a Spark cluster, you must grant the Spark cluster
access to Transformer.
For instructions, see Granting the Spark Cluster Access to Transformer in the Transformer engine documentation.
Advanced Mode
As you configure a Kubernetes deployment, Control Hub generates a valid YAML file used to provision the Kubernetes resources. The automatically generated YAML file is sufficient for most use cases. However, if you are an advanced Kubernetes user, you can use advanced mode to directly edit the deployment YAML file. For example, you might want to edit the YAML to attach extra volumes or to use a custom image.
To access advanced mode, in the Configure Kubernetes Deployment step in the deployment wizard, select Advanced Mode.
The wizard displays the generated YAML. You can directly edit the YAML in the wizard. Or, click the Download file icon () to edit the YAML in a text editor and then upload the edited file.
Click the Reset icon () to reset to the previously saved YAML.
Use caution when editing the YAML. Control Hub validates that the YAML uses the correct syntax, but cannot validate that you have specified an existing volume or image. Control Hub does place some restrictions on the edits you can make to the file.
The maximum YAML size is 16 KB.
Editing a Kubernetes Deployment
You can edit a Control Hub Kubernetes deployment while it is deactivated or active.
When you stop a Control Hub Kubernetes deployment, all Kubernetes resources created for that deployment are deleted. After you edit properties and then restart the deployment, the IBM StreamSets Kubernetes agent communicates with Control Hub to provision the Kubernetes resources needed to run engines and to deploy engine instances to those resources.
When you edit a deployment while it is active, existing Kubernetes resources might be deleted, depending on the following types of edited properties:
- General deployment or engine properties
- When you edit general deployment or engine properties while the deployment is active, the Kubernetes agent continues running the existing pods. Changes are replicated to all engine instances on the next restart of the engines.
- Kubernetes properties
- When you edit Kubernetes properties while the deployment is active, Kubernetes might replace all of the existing Kubernetes pods, depending on the change. If a replacement is needed, Kubernetes deletes the pods one by one to prevent engine downtime.
To edit a deployment, locate the deployment in the Deployments view. In the Actions column, click the More icon () and then click Edit.