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 legacy 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.
Autoscaling
You can configure a Kubernetes deployment to automatically scale the number of pods that host engine instances based on the current processing demand.
During times of high demand, Kubernetes automatically increases the number of engine instances. For each instance, Kubernetes creates a replicated pod, and then deploys and launches a single engine instance to the pod. During times of low demand, Kubernetes automatically decreases the number of engine instances. For each instance, Kubernetes stops the engine and removes the pod.
When you enable autoscaling, you define the minimum and maximum number of pods to create. You also define the thresholds that determine when to increase or decrease the number of pods.
You can configure Full Autoscaling (Recommended) or Legacy Autoscaling. Use the recommended full autoscaling for a more robust solution during times of high demand.
Functionality | Full Autoscaling | Legacy Autoscaling |
---|---|---|
Prerequisites | Requires that the parent Kubernetes environment use Kubernetes agent version 1.3.0 or later. | Requires a horizontal pod autoscaler and a metrics server set up by your Kubernetes administrator. |
Metrics | Scales pods based on CPU usage, memory usage, and running pipeline count. | Scales pods based on CPU usage only. |
Thresholds | Considers a range of values to scale out and in. For example, add more pods when CPU usage exceeds 70% and remove pods when CPU usage falls below 30%. |
Considers a single value to scale out and in. For example, add more pods when CPU usage exceeds 50% and remove pods when CPU usage falls below 50%. |
Minutes a threshold must be met before scaling pods | Configurable number of minutes. | Not configurable. |
Determining which pod to remove when scaling in | Attempts to remove pods with the fewest number of running pipelines. | Arbitrarily removes pods. |
Full Autoscaling (Recommended)
- CPU usage - Percentage of CPU used by each pod that hosts an engine instance.
- Memory usage - Percentage of memory used by each engine instance.
- Running pipeline count - Number of running pipelines on each engine instance.
You can configure a deployment to monitor all or some of the metrics. The Kubernetes agent monitors the average of the selected metrics across all engines belonging to the deployment.
- Scaling out thresholds
- Scaling out thresholds determine when to increase the number of pods. When the thresholds for any of the metrics are met, the Kubernetes agent increases the number of pods.
- Scaling in thresholds
- Scaling in thresholds determine when to decrease the number of pods. When the thresholds for all of the metrics are met, the Kubernetes agent decreases the number of pods.
Legacy Autoscaling
Legacy autoscaling scales the number of pods that host engine instances based on CPU usage only.
With legacy autoscaling, you define the CPU threshold percentage that determines when to increase or decrease the number of pods. You also must configure either the CPU Requested or CPU Limit property, or both.
For example, if CPU Requested is 100m, and CPU Threshold Percentage is 50%, Kubernetes creates additional pods that host engine instances when the average CPU usage for all existing pods exceeds 50%. Kubernetes removes pods when the average CPU usage falls below 50%.
When scaling in, Kubernetes arbitrarily removes pods.
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: .
To 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 Engine
Define the configuration of the engine to deploy. You can use the defaults to get started.
Configure the Kubernetes Deployment
Configure details about the pods provisioned in the Kubernetes cluster.
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.
Review and Launch the Deployment
You've successfully finished creating the deployment.
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.