Skip to content

k8s tomcat

최근식 edited this page Dec 10, 2020 · 2 revisions

목적

  • K8S 환경에서 Tomcat Session 복제 Cluster 구성하기
  • K8S 환경에서 Session은 Redis 와 같은 인메모리 권장
  • 하지만 소규모 컨테이너 운영환경의 경우 전통적인 WAS 단의 Session 복제 사용 가능
  • 개발자는 별도의 설정과 고민 없이 세션 사용 가능 장점

배포 절차

$ kubectl create -f serviceaccount.yml 
serviceaccount/tomcat-in-the-cloud created
role.rbac.authorization.k8s.io/tomcat-in-the-cloud created
rolebinding.rbac.authorization.k8s.io/tomcat-in-the-cloud created

$ kubectl run tomcat-web --image=docker.io/maxbeck/tomcat-in-the-cloud --port 8080 --serviceaccount="tomcat-in-the-cloud"
deployment.apps/tomcat-web created

$ kubectl get deployments
NAME           READY   UP-TO-DATE   AVAILABLE   AGE
tomcat-web     1/1     1            1           2m48s

$ kubectl scale deployment tomcat-web --replicas=3
deployment.apps/tomcat-web scaled

$ kubectl get deployments
NAME           READY   UP-TO-DATE   AVAILABLE   AGE
tomcat-web     1/3     3            1           3m6s

$ kubectl get service | grep tomcat
tomcat-in-the-cloud                        ClusterIP   None            <none>        42/TCP      12m

Clone this wiki locally