Managing a Specific Server or Service
All the servers and services reside in separate pods and are maintained by Kubernetes. General Kubernetes commands are available to check the status of your pod and to start, stop, and restart your pod.
To list and identify the appropriate pod:
kubectl -n name-of-namespace get pods
Here is an excerpt of typical output:
sas-cas-administration-7564yg89u1-8gfgx 1/1 Running 0 4h50s sas-compute-6dbbbds23h-n7ght 1/1 Running 0 3h34m sas-mail-cf78fgnj56-byu7r 1/1 Running 0 3h10s
To obtain the application name (app name), describe the pod:
This example describes a mail service.
kubectl -n name-of-namespace describe pod sas-mail-cf78fgnj56-byu7r
Here is an excerpt of typical output:
Name: sas-mail-cf78fgnj56-byu7r
Namespace: ABC
Priority: 0
Node: foo.com/10.1.2.3
Start Time: Sun, 23 Aug 2020 20:03:08 -0400
Labels: app=sas-mail
app.kubernetes.io/name=sas-mail
With the app name, you can perform different operations on your pod.
To check the status of your pod:
kubectl -n name-of-namespace get pods -l app=app-name
To restart the pod, delete it. The pod automatically restarts after it has been deleted.
kubectl -n name-of-namespace delete pods -l app.kubernetes.io/name=app-name
To stop the pod in a deployment:
kubectl -n name-of-namespace scale deployments/app-name --replicas=0
Setting the replicas argument
to 0 stops the pods that are running and ensures that no new pods
can be created.
To start the pod in a deployment:
kubectl -n name-of-namespace scale deployments/app-name --replicas=1
By default, the Horizontal Pod Autoscaler (HPA) setting for all services is set to a replica of 1. If you want to scale up your services or pods to more than 1 replica, then the default HPA setting should be modified. For instructions, see Configure High Availability in SAS Viya Platform: Deployment Guide.