Post deployment actions

Basic post-deployment operations

Checking application logs

To check the logs of a particular service, we can use the built-in mechanisms and using the kubectl tool we can check the logs in the following ways:

simple usage:

kubectl logs $pod-name -n $namespace

follow mode:

kubectl logs -f $pod-name -n $namespace

using labels:

kubectl logs -l $label-selector -n $namespace
kubectl logs -l app.kubernetes.io/name=ims-callback -n $namespace
kubectl logs -f -l app.kubernetes.io/name=ims-callback -n $namespace

with the determination of the time interval:

kubectl logs $pod-name --since=10m -n $namespace

Restart application

kubectl rollout restart is the preferred method for restarting an application, as it initiates a controlled restart of all pods in a given deployment without interrupting the application. This method makes it easy to update the application, allowing it to remain available by gradually replacing old pods with new ones.

kubectl delete pod command removes the selected pods manually, allowing you to restart the pod immediately without running a full rollout process. When a pod is deleted, the ReplicaSet controller will automatically create a new pod to reach the defined number of replicas.

Comparison of Methods: kubectl rollout restart vs kubectl delete pod

MethodDescriptionUse CaseAdvantagesDisadvantages
kubectl rollout restart deploymentRollout restart of a deployment – sequential restart of all pods in the deployment.Application updates and controlled restarts.Maintains application continuity, full deployment update, can monitor rollout progress.May be slower for larger numbers of pods.
kubectl delete podDeletes a specific pod, with automatic recreation by ReplicaSet.Restart of individual pods in case of localized errors.Fast restart, allows restarting only a specific pod.May cause brief application downtime if replicas are limited.