4.2. Frequently Used Commands
This chapter is a cheat sheet organized by category, so that the commands used most often in day-to-day operation can be found quickly. For the detailed explanation of each command, refer to 4.1. OPENMARU COP CLI and 3.1. OPENMARU COP Operating Procedures.
Project Management
Creating a Project
kubectl create namespace <namespace>
kubectl label namespace <namespace> pod-security.kubernetes.io/enforce=restricted
Checking Projects
# All namespaces
kubectl get namespaces
# Details of a particular namespace
kubectl describe namespace <namespace>
# An overview of all resources in a namespace
kubectl get all -n <namespace>
# The resource quota and usage per namespace
kubectl describe resourcequota -n <namespace>
Application Management
ℹ️ Note: Source builds are done with the S2I (Source-to-Image) CLI, and build automation with Jenkins jobs. For the detailed procedure, see 3.1. OPENMARU COP Operating Procedures > Building and Deploying Applications and the COP build and deployment guide.
Running an S2I Build and a Jenkins Job
# A direct S2I build
s2i build <source_location> <builder_image> <result_image>:<tag>
docker push registry.{sub_domain}.{domain}.{TLD}:8443/apps/<image_name>:<tag>
# Build, push, and deploy in one run with the Bastion scripts
cd /data/workspaces/apps/<namespace>/<app>
./build-app.sh && ./build-push.sh && ./build-deploy.sh
# Query the history and roll back
./build-history.sh
./build-rollback.sh <revision>
To run it as Jenkins jobs: <namespace>-<app>-build (S2I build and Harbor push) then <namespace>-<app>-deploy (deployment). For the full job list, see chapter 3.1, the CI/CD pipeline.
Deploying an Application
# Helm deployment
helm install <release> openmaru/<chart> -n <namespace> -f values.yaml
helm upgrade <release> openmaru/<chart> -n <namespace> -f values.yaml
helm rollback <release> <revision> -n <namespace>
helm list -A
helm status <release> -n <namespace>
helm history <release> -n <namespace>
# Update the image tag (manual deployment)
kubectl set image deployment/<name> <container>=<image>:<tag> -n <namespace>
kubectl rollout status deployment/<name> -n <namespace>
# ArgoCD synchronization (GitOps deployment)
argocd app sync <app-name> --grpc-web
argocd app wait <app-name> --grpc-web
argocd app history <app-name> --grpc-web
⚠️ Caution: Do not run
helm rollbackdirectly on an application managed by ArgoCD (GitOps). ArgoCD's auto-sync and self-heal return it to its original state immediately and the rollback is undone. Roll back an ArgoCD-managed application withargocd app rollback, or by reverting the manifest in the Git repository and then synchronizing.
Application Volume Configuration
kubectl get pvc -n <namespace>
kubectl patch pvc <pvc-name> -n <namespace> \
-p '{"spec":{"resources":{"requests":{"storage":"20Gi"}}}}'
Application Pod Information
kubectl get pods -n <namespace> -o wide
kubectl describe pod <pod-name> -n <namespace>
Application Service Information
kubectl get svc -n <namespace>
kubectl describe svc <svc-name> -n <namespace>
Application Ingress Information
kubectl get ingress -n <namespace>
kubectl describe ingress <ingress-name> -n <namespace>
Pod (Container) Management
Pod (Container) Information
kubectl get pods -n <namespace>
kubectl get pods -A -o wide
kubectl top pod -n <namespace>
Scaling Pods (Containers) Up
kubectl scale deployment <name> -n <namespace> --replicas=<count>
Scaling Pods (Containers) Down
kubectl scale deployment <name> -n <namespace> --replicas=<count>
Deleting a Pod (Container)
kubectl delete pod <pod-name> -n <namespace>
# Force deletion (a last resort)
kubectl delete pod <pod-name> -n <namespace> --grace-period=0 --force
Pod (Container) Log Information
kubectl logs -n <namespace> <pod-name> -f
kubectl logs -n <namespace> <pod-name> --previous
Connecting into a Pod (Container)
kubectl exec -it <pod-name> -n <namespace> -- bash
Private Registry Management
Private Registry Service State
docker login registry.{sub_domain}.{domain}.{TLD}:8443 -u admin -p ${HARBOR_PASSWORD}
The service state can be checked under Administration > System Info in the Harbor web console (https://registry.{sub_domain}.{domain}.{TLD}:8443).
Private Registry Image Information
docker tag <local-image>:<tag> registry.{sub_domain}.{domain}.{TLD}:8443/apps/<image>:<tag>
docker push registry.{sub_domain}.{domain}.{TLD}:8443/apps/<image>:<tag>
docker pull registry.{sub_domain}.{domain}.{TLD}:8443/apps/<image>:<tag>
Private Registry Directory (Project) Information
| Project | Visibility | Purpose |
|---|---|---|
library | Public | Shared base images |
images | Public | S2I builder images |
apps | Private | Customer application images |