Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

デブサミ 2019 【祝】k8sデビュー!エンタープライズ巨大アプリをマイクロサービスコンテナ化

2,749 views

Published on

ローンチから11年を経過したサービス「Shopらん」を今後も発展させていくために技術的負債の返済とマイクロサービス化、そしてAKSによるkubernetesへのデプロイに取り組んでいる内容について解説します。

Published in: Engineering
  • Be the first to comment

デブサミ 2019 【祝】k8sデビュー!エンタープライズ巨大アプリをマイクロサービスコンテナ化

  1. 1. #devsumiD
  2. 2. #devsumiD kensuke_ishida
  3. 3. #devsumiD
  4. 4. #devsumiD
  5. 5. #devsumiD
  6. 6. #devsumiD
  7. 7. #devsumiD
  8. 8. #devsumiD
  9. 9. #devsumiD
  10. 10. #devsumiD
  11. 11. #devsumiD
  12. 12. #devsumiD
  13. 13. #devsumiD
  14. 14. #devsumiD class SessionDAO { static Session load(String cookie) { } static Session create(Account user) { } static void delete(Session session) { } }
  15. 15. #devsumiD interface SessionService { Session load(String cookie); Session create(Account user); void delete(Session session); }
  16. 16. #devsumiD Session session = SessionDAO.load(cookie); Session session = SessionServiceFactory.getService() .load(cookie);
  17. 17. #devsumiD SessionService getService() { if (microserviceEnabled()) { // return new SessionServiceDriver(); } else { // return new SessionDAOProxy(); } }
  18. 18. #devsumiD
  19. 19. #devsumiD
  20. 20. #devsumiD • • • •
  21. 21. #devsumiD FROM openjdk:8-jre-alpine LABEL maintainer="build@shoprun.jp" EXPOSE 443 ARG JAR_FILE=target/session-0.0.1-SNAPSHOT.jar ADD ${JAR_FILE} service.jar ADD shoprun-service.p12 shoprun-service.p12 ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-Dspring.config.location=/etc/config/application.yaml", "-jar", "/service.jar"]
  22. 22. #devsumiD • •
  23. 23. #devsumiDCI / CD
  24. 24. • • •
  25. 25. #devsumiD 10.x.y.0/24 10.z.0.0/16
  26. 26. #devsumiD • •
  27. 27. #devsumiD
  28. 28. #devsumiD apiVersion: apps/v1beta1 kind: Deployment metadata: name: session-service labels: app: session-service spec: replicas: 3 strategy: rollingUpdate: maxSurge: 1 maxUnavailable: 1 minReadySeconds: 5 template: metadata: labels: app: session-service spec: containers:
  29. 29. #devsumiD { 'application.yaml’: 'server: port: 443 ssl: enabled: true protocol: TLSv1.2 … ' } spec: containers: - image: xxxxxx.azurecr.io/session-service volumeMount: - mountPath: /etc/config /etc └ config └ application.yaml
  30. 30. #devsumiD
  31. 31. #devsumiD apiVersion: apps/v1beta1 kind: Deployment metadata: name: stg-session-service spec: template: volumes: - configMap: name: stg-special-config-d655274926 name: configmap-volume
  32. 32. #devsumiD ログ収集の仕組み /var/lib/docker/containers/… stdout tcp/9200 REST
  33. 33. #devsumiD
  34. 34. #devsumiD https://github.com/fluent/fluentd-kubernetes-daemonset spec: tolerations: - key: node-role.kubernetes.io/master effect: NoSchedule containers: - name: fluentd-elasticsearch image: fluent/fluentd-kubernetes-daemonset:v1.3.3-debian-elasticsearch-1.0 env: - name: FLUENT_ELASTICSEARCH_HOST value: "elasticsearch-server" - name: FLUENT_ELASTICSEARCH_PORT value: "9200" - name: FLUENT_ELASTICSEARCH_SCHEME value: "http" - name: FLUENT_UID value: "0"
  35. 35. #devsumiD https://git.io/fhQNs
  36. 36. #devsumiD • •
  37. 37. #devsumiD
  38. 38. #devsumiD
  39. 39. #devsumiD 7.05ms 26.07ms •
  40. 40. #devsumiD
  41. 41. #devsumiD JHipster
  42. 42. #devsumiD
  43. 43. #devsumiD
  44. 44. #devsumiD
  45. 45. #devsumiD
  46. 46. #devsumiD
  47. 47. #devsumiD dreamarts_pr

×