클라우드 교육/kubernetes
쿠버네티스 컨테이너 설정 변경
mellamo
2023. 5. 6. 17:14
쿠버네티스에서는 파드 내 컨테이너의 /etc/hosts를 변경 가능한데
spec.hostAliases로 지정할 수 있다.
apiVersion: v1
kind: Pod
metadata:
name: s6
spec:
containers:
- name: nginx-container
image: nginx:1.12
hostAliases:
- ip: 8.8.8.8
hostnames:
- google-dns
- google-public-dns
위처럼 hostAliases 아래 지정하면
확인했을때 변경된 것을 확인할수있다.
이번에는 컨테이너 접속 시 시작 디렉터리 설정
spec.containers.workingDir 로 설정하면
apiVersion: v1
kind: Pod
metadata:
name: s7
spec:
containers:
- name: nginx-container
image: nginx:1.16
workingDir: /tmp
시작위치가 바뀌는것을 확인할 수 있다.