반응형
git repo: https://github.com/sungwook-practice/code-server-demo
ingress에서 your-host를 도메인으로 수정한 후, 쿠버네티스 리소스를 배포하시면 됩니다. code-server가 web-socket를 사용해서 websocket설정을 annotations에 추가했습니다.
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: code-server
name: code-server
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: code-server
template:
metadata:
labels:
app: code-server
spec:
containers:
- image: codercom/code-server:4.9.1
name: code-server
env:
- name: PASSWORD
value: "password"
ports:
- name: web
containerPort: 8080
protocol: TCP
resources:
requests:
cpu: "1.0"
memory: "2Gi"
limits:
cpu: "1.0"
memory: "2Gi"
---
apiVersion: v1
kind: Service
metadata:
name: code-server
namespace: default
spec:
ports:
- port: 80
targetPort: 8080
selector:
app: code-server
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: code-server
namespace: default
annotations:
nginx.org/websocket-services: "code-server"
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.org/server-snippets: |
location / {
proxy_pass http://{{your-host}}:80/;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_set_header Accept-Encoding gzip;
}
spec:
ingressClassName: nginx
rules:
- host: {{your-host}}
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: code-server
port:
number: 80
반응형
'전공영역 공부 기록' 카테고리의 다른 글
code-server pod ipynb파일이 안열릴 때 (2) | 2023.01.01 |
---|---|
쿠버네티스 Headless 서비스 (0) | 2023.01.01 |
helm hook 사용방법 (0) | 2022.12.25 |
자주사용하는 curl 명령어 정리 (0) | 2022.12.24 |
EKS add-ons (0) | 2022.12.21 |