How to deploy an application (step-by-step)

Creating workloads in a namespace and checking deployment status.

Application deployment is performed through the creation of Kubernetes objects in the Loads section of the selected namespace. The workload in Kubernetes runs in pods, and for production scenarios, pods are usually managed by controllers: they maintain the required number of pods, recreate them when failures occur, and apply changes from the manifest.

Select the type of workload for the task:

Workload typeWhen to use
DeploymentStateless applications, rolling update, rollback, replica scaling. Deployment manages ReplicaSet, and ReplicaSet supports the required number of pods.
StatefulSetStateful services that require persistent pod names, startup/update order, and persistent volumes via PersistentVolumeClaim.
DaemonSetAgents and daemons that must run on each suitable node: monitoring, logging, network components.
JobA one-time task that must run to completion.
CronJobPeriodic task on a cron schedule.
PodOne-time or debugging cases. For production, use Deployment, StatefulSet, DaemonSet, Job or CronJob.
ReplicaSetTypically created and managed by Deployment. It is available for viewing in the GUI, but the ReplicaSet parameters can be edited through Deployment.

For an official description of workload objects, see the Kubernetes documentation: Workloads.


What to prepare before deployment

Before creating a workload, make sure that the application container image is built and accessible from the cluster.

  1. Publish the image to your internal registry.
  2. Use stable version tags instead of latest in production: for example, v1.0.0, semver or git-sha.
  3. If your private registry does not require authentication, it is enough to indicate its address in the workload manifests. To configure private registry authentication, see How to connect a private registry.
  4. If your cluster has image signature verification policies enabled, sign the image and pass the public key to the policy. More details: Signing containers and verifying images.

Step 1. Select a cluster and namespace

  1. Select the desired cluster in the left menu.
  2. Select the target namespace from the list of available ones (only namespaces to which you have access rights are displayed).

Step 2: Create a workload

Go to the Loads section and select the object type. The Deployments tab lists deployments in the namespace.

Deployment

Deployment manages and scales the application pods: creates a ReplicaSet, maintains the required number of replicas, applies updates, allows you to rollback versions and restores pods when failures occur. This is the main option for stateless applications.

  1. Click +Add Deployment.
Screenshot: creating Deployment

Deployment creation

  1. Fill out the deployment description.

Deployment Management block:

  • number of replicas - default 1;
  • deployment type - default RollingUpdate;
  • whether deployment is suspended - the default value is not specified;
  • for the RollingUpdate type - the maximum value of unavailable and additional replicas, by default 25%;
  • ProgressDeadlineSeconds—time to wait for deployment in seconds before it is considered completed with an error; default 600 sec (10 minutes);
  • RevisionHistoryLimit — the number of ReplicaSets for the rollback option; default is 10.
Screenshot: pod template

Pod template

Pod template block:

  • whether to use hostPID - not selected by default;
  • whether to use host network - not selected by default;
  • Image Pull Secrets — select secrets from the drop-down list (secrets are created on the Storage tab of the Namespace section);
  • priority of the pod relative to other pods in the cluster;
  • container host name;
  • Tolerations — press + and fill in the fields;
  • nodes — click + in the node selector;
  • ServiceAccountName — select from the drop-down list;
  • connection of an account token - not specified by default.
Screenshot: init containers

Init containers

Blocks “Initialization containers” and “Containers”:

  • container name;
  • image;
  • Image Pull Policy - default IfNotPresent;
  • commands and arguments (if necessary);
  • ports - click + to add;
Screenshot: ports

Screenshot: ports in the platform GUI

  • computing resources - requests and limits for CPU (in CPU or m) and Memory (B, Ki, Mi, Gi);
Screenshot: requests and limits

Requests and limits

  • Volume mounts — press +;
Screenshot: volume mounts

Volume mounts

  • environment variables - press +.
Screenshot: environment variables

Environment Variables

More information about the parameters of the pod template, containers, Security context and volumes can be found on the Pod tab below.

  1. Click Add.

View Deployment

The following tabs are available on the viewing page:

  • Deployment — information about the creation date, status, state, deployment type, pause flag, pod selector, number of replicas and CPU/Memory metrics for the last hour;
  • Pod template - containers, init containers and volumes;
  • HPA — automatic horizontal scaling;
  • ReplicaSets — list of ReplicaSets created by Deployment, with the number of pods, status and image;
  • Pods — a list of pods with filters by name, namespace, status, parent object, node and QoS;
  • Security — results of image scanning and configuration analysis, if the corresponding modules are installed in the cluster;
  • Labels and annotations, Events, Manifest.
Screenshot: Deployment pod template

Deployment pod template

Screenshot: ReplicaSets Deployment

ReplicaSets Deployment

Screenshot: Deployment security

Deployment Security

StatefulSet

StatefulSet deploys a set of pods with persistent identifiers and data persistence across restarts; guarantees unique names and stable network identity of pods.

  1. Click + Create StatefulSet.
  2. In the Description block, specify the name StatefulSet.
  3. If necessary, define labels and matching pod labels in the Pod Selector block.
  4. Set the specification:
    • number of replicas;
    • number of partitions;
    • minReadySeconds;
    • revisionHistoryLimit — default 10;
    • podManagementPolicy: OrderedReady (default) or Parallel;
    • serviceName;
    • PersistentVolumeClaim storage policy - whenDeleted and whenScaled (by default Retain, Delete is also available).
  5. Define PersistentVolumeClaim templates: Press +, set the name, Access Modes (default ReadWriteOnce), Storage Class Name, size (B, Ki, Mi, Gi) and press Save.

Available PVC access modes:

  • ReadWriteOnce (RWO) - read and write from only one node;
  • ReadOnlyMany (ROX) - read only from several nodes;
  • ReadWriteMany (RWX) - reading and writing from several nodes;
  • ReadWriteOncePod (RWOP) - reading and writing by only one pod.

Storage Class Name specifies the storage class, such as standard, fast, or slow. The PVC size is specified in standard Kubernetes units: B, Ki, Mi, Gi.

Screenshot: PVC template

PVC template

  1. Define init containers and/or containers, pod template; assign Volumes if necessary. Pod and container template parameters are the same as when creating a Pod (see Pod tab below).

View and edit StatefulSet

The view page has StatefulSet, Pods, Pod Template, PVC Templates, Security, Labels and Annotations, Events, Manifest tabs. The StatefulSet tab displays partition, minReadySeconds, revisionHistoryLimit, podManagementPolicy, serviceName, PVC storage policy, pod selector and CPU/Memory metrics for the last hour.

Screenshot: StatefulSet page

StatefulSet Page

You can edit the StatefulSet specification, PVC storage policy, pod template, init containers, containers and volumes. You can also change the YAML in the Manifest tab: after changing, do Verify, then save the result.

DaemonSet

DaemonSet ensures that a pod runs on every node in the cluster; the number of replicas is not specified.

  1. Click + Create DaemonSet.
  2. In the Description block, specify the name of the DaemonSet.
  3. If necessary, define labels and matching pod labels in the Pod Selector block.
  4. Set the specification:
    • minReadySeconds — default 0;
    • revisionHistoryLimit — default 10;
    • maximum number of inaccessible and additional pods.
  5. Define init containers and/or containers, pod template; assign Volumes if necessary. Parameters are the same as when creating a Pod (see Pod tab below).
Screenshot: DaemonSet page

DaemonSet Page

View and edit DaemonSet

The view page has DaemonSet, Pods, Pod Template, Security, Labels and Annotations, Events, Manifest tabs. The DaemonSet tab displays creation date, status, state, minReadySeconds, revisionHistoryLimit, maximum number of unavailable and additional pods, pod selector and CPU/Memory metrics for the last hour.

You can edit the DaemonSet specification, pod template, init containers, containers and volumes. YAML is available on the Manifest tab; After the change, check and save the changes.

Pod

Pod is the minimum computing unit (one or more containers). Individual pods are suitable for one-off or debugging tasks; for production, it is recommended to manage pods through Deployment, StatefulSet or DaemonSet.

The Pods page displays the pod name, the ratio of running containers to the total number of containers, the number of restarts, creation date, namespace, status, parent object, node, QoS and labels. Filters are available by name, namespace, status, parent object, node and QoS.

Screenshot: Pods list

Pods List

  1. Click +Add Pod.
Screenshot: creating a Pod

Creating a Pod

  1. In the Pod Specification block, specify the hostPID, host network, restart policy, Image Pull Secrets, Tolerations, host selector, ServiceAccountName and other parameters.

Restart Policies:

  • Always — the container is restarted after any completion; default value;
  • OnFailure — the container is restarted only when it terminates with an error;
  • Never — a completed container is not restarted automatically.

When configuring Tolerations, you can specify the key and value of the node’s taint, the operator Exists or Equal, the effect NoSchedule, PreferNoSchedule, NoExecute or Any, and tolerationSeconds. If the NoExecute effect is selected, tolerationSeconds specifies the period after which the pod will be evicted from the node. The default for this case is 5 minutes.

Screenshot: Tolerations

Tolerations

  1. Set up Init containers, Containers and Volumes.
Screenshot: pod template

Pod template

Security context pod

At the pod level, you can configure security settings that apply to all containers:

  • fsGroup — file system group for changing the owner and rights of files when mounting a volume;
  • change policy fsGroup: OnRootMismatch or Always. The policy does not apply to volumes secret, configMap, and emptyDir;
  • runAsGroup, runAsUser, runAsNonRoot;
  • supplementalGroups;
  • kernel parameters sysctl. If sysctl is unsafe, the pod will not start until at least one node has these parameters enabled;
  • Seccomp profile: default profile, custom profile on the node, or disable the profile. More details: Seccomp.
Screenshot: Security context of the pod

Security context of the pod

Init containers and containers

In the Init containers and Containers blocks, set:

  • container name and image;
  • working directory (Workdir), commands and arguments;
  • Image Pull Policy: Always, IfNotPresent or Never;
  • ports, environment variables, requests and limits for CPU/Memory;
  • volume mounts: mountPath, mountPropagation, subPath, subPathExpr;
  • Security context of the container.

The security context of the container overrides the settings specified at the pod level. If privileged mode is enabled (privileged: true), the container receives all Linux capabilities; the Seccomp profile for such a container cannot be set in the GUI.

Screenshot: Security context of the container

Security context of the container

For container resources, set requests and limits. If the memory limit is not specified and there is no default limit in the namespace, the container can use all the available memory of the node. If the sum of the pod’s container memory requests exceeds the node’s memory, the pod will not run on that node.

Volumes

In the Volumes block, add the volumes that will be mounted in the containers:

  • ConfigMap — configuration data, if necessary defaultMode;
  • DownwardAPI — transferring information about the Pod to containers: annotations, labels, name, namespace;
  • EmptyDir - ephemeral volume for reading and writing by several Pod containers; you can choose medium and size;
  • PersistentVolumeClaim — connection of an existing PVC, if necessary read-only;
  • Secret — confidential data, mounted read-only;
  • HostPath — file or directory from the host file system.
Screenshot: ConfigMap volume parameters

ConfigMap volume parameters

Screenshot: DownwardAPI volume parameters

DownwardAPI volume parameters

Screenshot: EmptyDir volume parameters

EmptyDir volume parameters

Screenshot: PVC volume parameters

PVC volume parameters

Screenshot: Secret volume parameters

Secret volume parameters

Screenshot: HostPath volume parameters

HostPath volume parameters

View Pod

The Pod page has Pod, Containers, Volumes, Security, Labels and Annotations, Events, Manifest, Terminal, Logs tabs.

Pod QoS is determined by requests and limits of containers:

  • Guaranteed — each container’s request CPU/Memory is equal to limit CPU/Memory;
  • Burstable — at least one container has a request or limit;
  • BestEffort - no container has requests or limits.

QoS is taken into account when pods are evicted from a node during Node Pressure: BestEffort is evicted first, then Burstable, then Guaranteed.

The Terminal tab is displayed if at least one container has a shell. Bash is not supported. Correct operation of the terminal is guaranteed only in Google Chrome.

Screenshot: Pod terminal

Terminal Pod

On the Logs tab you can select a container, enable or disable auto-update, timestamps and previous log, set the number of records, time range, text search and download the .log file.

Screenshot: Pod logs

Pod logs

Job

Job manages the execution of parallel or one-time tasks that are restarted when failures occur.

  1. Click +Add Job.
  2. Fill in Description, Template Job and container information. Parameters for init containers, containers and pod template - as when creating a Pod (see Pod tab below).
  3. Click Save.
Screenshot: Job page

Job page

On the Job view page, the following tabs are available: Job,Pods, Pod Template, Labels and Annotations, Events, Security, Manifest. The Job tab displays status, status, lastScheduleTime, lastSuccessfulTime, completions, completionMode, ttlSecondsAfterFinished, parallelism, backoffLimit, activeDeadlineSeconds, pod selector and CPU/Memory metrics for the last hour.

CronJob

CronJob runs periodic tasks according to a cron schedule.

  1. Click +Add CronJob.
  2. Fill out Description, CronJob Specification, Template Job and container details. Container parameters are the same as when creating a Pod (see Pod tab below).
  3. Click Save.
Screenshot: CronJob page

CronJob Page

The CronJob page has CronJob, Pods, Jobs, Job Template, Labels and Annotations, Events, Security, Manifest tabs. The CronJob tab displays the schedule, concurrencyPolicy, startingDeadlineSeconds, successfulJobsHistoryLimit, failedJobsHistoryLimit, Suspended/Unsuspended status, pod selector and CPU/Memory metrics for the last hour.

The Jobs tab contains Jobs created by CronJob with status and image.

A ReplicaSet supports a given number of identical pods and is typically created by a Deployment. In most scenarios, don’t create or edit a ReplicaSet directly: modify the Deployment that manages it.

The ReplicaSets page displays sets of replicas in the namespace. If a ReplicaSet is part of a Deployment, its parameters on the ReplicaSet page are not editable.

Screenshot: ReplicaSet page

ReplicaSet page

The view page has ReplicaSet, Pods, Pod Template, Security, Labels and Annotations, Events, Manifest tabs. The ReplicaSet tab displays creation date, status, parent object, number of replicas, minReadySeconds, pod selector and CPU/Memory metrics for the last hour. On the Manifest tab, the YAML can be viewed and copied.


Step 3: Check deployment status

  1. Open the created workload in the Loads section.
  2. Go to the Pods tab - pods should switch to the Running status (or Completed for Job).
Screenshot: Deployment's Pods tab

Pods Deployment

On the Pods tab, filtering by name, namespace, status, parent object, node and QoS is available; sorting by creation date and number of restarts. Possible status values in the filter: Running, Pending, Terminating, CrashLoopBackOff, Completed, Failed, Unknown. Clicking on a pod’s row opens the pod’s view page.

Color indication of pod status:

  • green — Running, Completed;
  • yellow — Pending;
  • red - Terminating, CrashLoopBackOff, Failed;
  • gray — Unknown.
  1. If necessary, look at the logs on the Logs tab of the pod page or the events on the Events tab of the created workload.

More details: Workload troubleshooting.


Step 4. Modify and scale

Scaling Deployment or StatefulSet

On the Deployment or StatefulSet tab of the view page, locate the scaling block, change the number of replicas, and save the changes.

Screenshot: Deployment page

Deployment page

In the GUI, the HPA object is embedded as a tab on the Deployment object page. On the HPA tab of the Deployment page, set the target average CPU and/or Memory usage over the last 5 minutes. If the value is exceeded, the number of pods will increase within the specified replica range; when the load decreases, it will decrease. The HPA object is created with an automatically generated name and is managed only from this tab. Also, the HPA object is available for creation and editing from the “Custom Resources” page of the “Administration” section of the cluster and namespace.

Screenshot: HPA

Screenshot: HPA in the platform GUI

Prepare YAML manifests and apply objects via Import manifests.

There are two main autoscaling options available in Kubernetes:

  • HPA (Horizontal Pod Autoscaler) - changes the number of Deployment or StatefulSet pods based on CPU, memory or custom metrics.
  • VPA (Vertical Pod Autoscaler) — selects container requests/limits based on historical data. (Will be implemented in release 2.15.0)

HPA

Prerequisites:

  • shturval-metrics-collector must be installed in the cluster. If you do not have access to shturvalserviceconfigs, then you can understand the presence of an installed service by displaying CPU and RAM utilization graphs in the GUI workload interface;
  • for HPA by CPU/Memory, containers must have requests set, otherwise the metrics will not be calculated.

Example HPA:

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: my-app-hpa
  namespace: my-namespace
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: my-app
  minReplicas: 2
  maxReplicas: 10
  metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 70
  - type: Resource
    resource:
      name: memory
      target:
        type: Utilization
        averageUtilization: 80

Check HPA status:

kubectl get hpa my-app-hpa -n my-namespace
kubectl describe hpa my-app-hpa -n my-namespace

The output shows the current and desired number of replicas, current metric values, and scaling events.


Deployment security

When creating a workload, check the security settings of the pods and images:

  • set runAsUser, runAsGroup, runAsNonRoot and other Security context parameters where applicable;
  • Use Seccomp profiles to restrict pod or container system calls. More details: Seccomp;
  • keep in mind that the Security context of the container overrides the Security context of the pod;
  • do not enable privileged mode unless necessary: it cancels some protections, including Seccomp;
  • store registry credentials in Kubernetes Secrets, not in clear form in manifests;
  • use signing of container images and signature verification policies if required by the security requirements. More details: Modifying policies and image signing.

The Security tab for workloads shows image vulnerability scan results and security policy compliance analysis when the corresponding modules are installed in the cluster.


Remove workload

  • Deployment, StatefulSet, DaemonSet, Job, CronJob — cart icon in the object line on the list page; Delete button on the viewing page; Trash icon on the Manifest tab.
  • CronJob — additionally available options are Delete completely and Delete with re-creation (a creation form will open with pre-filled data for the deleted CronJob).
  • Pod — Delete (correct termination) or Forcibly delete for pods in the Terminating state.