728x90
반응형
- index.html 아래와 같이 넣기
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>My Web Page</h1>
</body>
</html>
- style.css 아래와 같이 넣기
* {
color: blue;
}
- Dockerfile 에 아래와 같이 넣기
FROM nginx
COPY ./ /usr/share/nginx/html
terminal에서
도커 이미지 빌드
docker build -t my-web-server .
파드를 띄우기 위해서는 manifest( yaml )이 필요함
web-server-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: web-server-pod
spec:
containers:
- name: web-server-container
image: my-web-server
imagePullPolicy: IfNotPresent
ports:
- containerPort: 80
이 manifest를 기반으로 파드 생성
kubectl apply -f web-server-pod.yaml
파드 확인
kubectl get pods
포트포워딩
kubectl port-forward web-server-pod 5000:80
728x90
반응형
'쿠버네티스' 카테고리의 다른 글
| 백엔드(Spring Boot) 서버 3개 띄워보기 (0) | 2026.01.30 |
|---|---|
| 프론트엔드(Next.js) 서버를 파드(Pod)로 띄워보기 (0) | 2026.01.30 |
| 백엔드(Nest.js) 서버를 파드(Pod)로 띄워보기 (0) | 2026.01.30 |
| 이미지가 없다고 에러가 뜨는 이유 (이미지 풀 정책) (0) | 2026.01.30 |
| 백엔드(Spring Boot) 서버를 파드(Pod)로 띄워보기 (0) | 2026.01.29 |