반응형
모든 GameServer 삭제
kubectl delete gs --all -n <namespace>
특정 조건의 GameServer 삭제
workflow DeleteAllGS
{
$nsName = "cv-agones-dev"
$gslist = (kubectl get gs -n $nsName -o json | ConvertFrom-Json).items
ForEach -Parallel ($gs in $gslist) {
if ($gs.status.state -eq "Starting") {
kubectl delete gs $gs.metadata.name -n $nsName
}
}
}
DeleteAllGS
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
eks 자격증명 얻기
aws eks update-kubeconfig --region region-code --name <my-cluster>
docker & k8s run
docker run -it --name colorverse-app -p 7777:7777/udp colorverse-app:0.1
docker exec -it --privileged <docker id> bash
docker start -a <container id>
kubectl exec -it app-testcluster995-7xyapowcb3fe9jmktbzmc-5eyczugzj8fp-pod-n46fk -n colorverseapp -- /bin/bash
container registry push
[azure]
docker build --force-rm --tag gameserver-app:0.3 . --no-cache
az acr login -n acitest998
docker tag gameserver-app:0.3 acitest998.azurecr.io/gameserver-app:0.3
docker push acitest998.azurecr.io/gameserver-app:0.3
[aws]
docker build --force-rm --tag gameserver-app:agones-1 . --no-cache
aws ecr get-login-password --region ap-northeast-2 | docker login --username AWS --password-stdin <AWSID>.dkr.ecr.ap-northeast-2.amazonaws.com
docker tag gameserver-app:0.1 <AWSID>.dkr.ecr.ap-northeast-2.amazonaws.com/gameserver-app:0.19
docker push <AWSID>.dkr.ecr.ap-northeast-2.amazonaws.com/gameserver-app:0.19
docker tag gameserver-app:0.1 <AWSID>.dkr.ecr.ap-northeast-2.amazonaws.com/gameserver-app:latest
docker push <AWSID>.dkr.ecr.ap-northeast-2.amazonaws.com/gameserver-app:latest
docker rmi gameserver-app:0.1
docker rmi <AWSID>.dkr.ecr.ap-northeast-2.amazonaws.com/gameserver-app:0.19
linux service 재 실행
sudo systemctl enable k8s-controller.service
sudo systemctl start k8s-controller.service
sudo systemctl stop k8s-controller.service
sudo systemctl restart k8s-controller.service
sudo systemctl status k8s-controller.service
sudo systemctl disable k8s-controller.service
kubernetes container log 확인
kubectl logs -f <pod id> <container name> -n <namespace>
kubectl logs -f cv-game-server-custom cv-game-server -n agones-system
반응형
LIST
'IT > Kubernetes' 카테고리의 다른 글
[Docker] 도커 설치 (0) | 2023.04.08 |
---|---|
[Docker] 도커 시작하며 사전 조사했던 내용 (1) | 2023.04.08 |
Kubernetes 스터디 목차 (0) | 2023.04.08 |
[Agones] Agones.Model.GameServerObjectMeta.ToString() [0x00000] (0) | 2023.04.08 |
K8S Resource 팁(powershell) (0) | 2023.04.06 |