[TIP] Kubernetes에 Powershell pod 생성하기

Dante·2023년 11월 2일
0

tips

목록 보기
2/2

작년 10월에 스택오버플로우에서 흥미로운 질문 글을 보았다.
Kubernetes에 Windows Powershell pod를 띄어보는거 였는데, 작성자님은 pod를 생성하면 계속 CrashLoopBackOff이 발생한다고 해서 도움을 받기 위해 stackoverflow에 글을 올리셨다.

(powershell pod failing in kubernetes cluster)

흔히 사람들이 busybox pod를 많이 사용하는데, 해당 pod를 생성할 때 command 에 sleep 명령어를 추가하여 생성한다.
powershell도 비슷한 개념으로 pod를 생성하면 Running 상태로 유지할 것 같아 이 내용을 참고하여 답변을 달았다.

Create Powershell pod

apiVersion: v1
kind: Pod
metadata:
  name: powershell
spec:
  containers:
  - name: powershell
    image: mcr.microsoft.com/powershell:latest
    command: ["pwsh"]
    args: ["-Command", "Start-Sleep", "3600"]
    

Run powershell pod

[root@master1 ~]# kubectl get pod powershell
NAME         READY   STATUS    RESTARTS   AGE
powershell   1/1     Running   0          3m32s
[root@master1 ~]# kubectl exec -it powershell -- pwsh
PowerShell 7.2.6
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

PS /> date
Thu Oct 13 12:50:24 PM UTC 2022
PS />
profile
it's me.

0개의 댓글