I have some projects in OC, and the names of the pods are generated in base of a chain and a commit. So, I want create an instruction in AzureDevOps to delete all the pods by an incomplete name the name with an specific characters, but finishing with others.
Example:
root@oc-jump-pod:/# oc get po
NAME READY STATUS RESTARTS AGE
podA-74rt7 1/1 Running 0 20h
podB-6744849c59 1/1 Running 0 20h
podB-6746378213 1/1 Running 0 20h
I need use something like:
oc delete po podB*
Error from server (NotFound): pods "podB*" not found
How can I filter the deletion with a couple of characters and not the complete name of the pod?
DeployConfig added:
root@oc-jump-pod-pre:/# oc describe deploy NAME
Name: NAME
Namespace: NAME-pre
CreationTimestamp: Mon, 25 May 2020 07:01:14 +0000
Labels: app.kubernetes.io/instance=NAME
app.kubernetes.io/managed-by=Helm
app.kubernetes.io/name=NAME
app.kubernetes.io/version=latest
helm.sh/chart=NAME-1.0.0
Annotations: deployment.kubernetes.io/revision=3
meta.helm.sh/release-name=NAME
meta.helm.sh/release-namespace=sda-NAME-pre
Selector: app.kubernetes.io/instance=NAME,app.kubernetes.io/name=NAME
Replicas: 1 desired | 1 updated | 1 total | 1 available | 0 unavailable
StrategyType: RollingUpdate
MinReadySeconds: 0
RollingUpdateStrategy: 25% max unavailable, 25% max surge
Pod Template:
Labels: app.kubernetes.io/instance=NAME
app.kubernetes.io/name=NAME
Service Account: default
Containers:
NAME:
Image: registry/sda-NAME-dev/test-NAME-java:0.0.2
Port: 8080/TCP
Limits:
cpu: 150m
memory: 1444Mi
Requests:
cpu: 100m
memory: 1Gi
Environment:
APP_NAME: NAME
JAVA_OPTS_EXT: ....
SPRING_CLOUD_CONFIG_PROFILE: pre
TZ: Europe/Madrid
WILY_MOM_PORT: 5001
spring_application_name: NAME_pre
spring_cloud_config_uri: https://config.d.cluster.local
Mounts:
/etc/jks from jks (ro)
/etc/secret-vol from secretvol (ro)
/etc/truststore from jssecacerts (ro)
Volumes:
....
Conditions:
Type Status Reason
---- ------ ------
Progressing True NewReplicaSetAvailable
Available True MinimumReplicasAvailable
OldReplicaSets: NAME-6744849c59 (1/1 replicas created)
NewReplicaSet: <none>
Events: <none>