반응형
무조건 모든 pod 삭제
kubectl delete pod --all -n my-namespace
특정조건을 바탕으로 pod 삭제가 필요할 때
workflow DeleteAllPod
{
$nsName = "my-namespace"
$podlist = (kubectl get pod -n $nsName -o json | ConvertFrom-Json).items
ForEach -Parallel ($pod in $podlist)
{
kubectl delete pod $pod.metadata.name -n $nsName
}
}
DeleteAllPod
agones GameServer의 일부 정보만 출력
function ShowGameserverInfo
{
$nsName = "cv-agones-dev"
$gslist = (kubectl get gs -n $nsName -o json | ConvertFrom-Json).items
foreach ($gs in $gslist){
if ($gs.status.state -eq "Allocated"){
#$gs.metadata
#$gs.status.address
#$gs.status.ports.port
#$gs.metadata.annotations
Write-Host "[" $gs.metadata.name "]"
Write-Host " - address:" $gs.status.address ":" $gs.status.ports.port
Write-Host " - channel id:" $gs.metadata.annotations.'cv-room-chnl-id'
Write-Host " - secret key:" $gs.metadata.annotations.'cv-room-secret-key'
Write-Host " - room info:" $gs.metadata.annotations.'cv-room-info'
Write-Host " - normal user:" $gs.metadata.annotations.'agones.dev/sdk-cv-normal-users'
Write-Host " - gm users:" $gs.metadata.annotations.'agones.dev/sdk-cv-gm-users'
Write-Host " - debug info:" $gs.metadata.annotations.'agones.dev/sdk-cv-debug-info'
}
}
}
ShowGameserverInfo
agones Allocated된 gs들의 특정 annotation 출력
function ShowNormalUsers
{
$nsName = "my-namespace"
$gslist = (kubectl get gs -n $nsName -o json | ConvertFrom-Json).items
foreach ($gs in $gslist){
if ($gs.status.state -eq "Allocated"){
#$gs.metadata
Write-Host $gs.metadata.name ": normalusers:" $gs.metadata.annotations.'agones.dev/sdk-cv-normal-users'
#$gs.metadata.annotations.cv-room-info
}
}
}
ShowNormalUsers
반응형
LIST
'IT > Kubernetes' 카테고리의 다른 글
[Docker] 도커 설치 (0) | 2023.04.08 |
---|---|
[Docker] 도커 시작하며 사전 조사했던 내용 (1) | 2023.04.08 |
Kubernetes 스터디 목차 (0) | 2023.04.08 |
K8S 사용하면 유용한 팁들 (0) | 2023.04.08 |
[Agones] Agones.Model.GameServerObjectMeta.ToString() [0x00000] (0) | 2023.04.08 |