Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How we build microservices with Kubernetes & Kafka

Yun Chen
September 26, 2019

How we build microservices with Kubernetes & Kafka

An introduce to K8S and Kafka

Yun Chen

September 26, 2019
Tweet

More Decks by Yun Chen

Other Decks in Programming

Transcript

  1. HOW WE BUILD MICROSERVICES WITH KUBERNETES & KAFKA SDN X

    CLOUD NATIVE MEETUP #20 https://speakerdeck.com/chenyunchen/redis-lua-script-with-red-envelope-and-message-queue
  2. WHO AM I Chen Yun Chen (Alex) > [email protected] >

    blog.yunchen.tw Experience > Backend Engineer at JKOPay > Software Engineer at Linker Networks
  3. CONTAINER ቘ薹膏褖ګ > Container != Docker > Appᥝெ讕瞥獤ग़㮆Dockerfile? > Log෭扮ইຎ茴褸?

    > 緳矒᯿珸ᥝெ讕ڣ䥁? > ਻瑊絑ह牏܋羷ፘ狅䷱㺔氂? 4
  4. KUBERNETES 硌獅膏褖ګ > Storage: CSI (Container Storage Interface) 吖瑿猋ൔ, ਻梊秚ګ,

    盠ᆙ, ᯿蕦虻碘㳫ᴻ? > Network: CNI (Container Network Interface) ๅṛጱ窕ᰁ, ๅ犵ጱ皤螛, ๅग़ጱ翕᪠Օᶎ? > Computing: CRI (Container Runtime Interface) 犋አDocker? ೭㬵᪒VM? 窾ݳContainer&VM? 5
  5. 疩獈WEBSOCKET蝫娄 Auth Server > 奈TCP蝫娄 ׀Android, iOS藨挨 WebSocket Server >

    WebSocket蝫娄 ׀Web藨挨 翕殷粚氃क़螵蜉襑穩 8
  6. 瞥獤LOGIC๐率 Http Server > ׀獉蟂ٌਙ㿁褧 篷ဩ蝚螂gRPCොୗፗ蝫Logic Avatar Server > 蕣狶㮆Ո牏ᗭ奲瑽猟

    Message Center Server > 懱௳๐率ፘ橕 File Server > 䲆礯๐率ፘ橕牏ݱ圵疳ੑ婘瑽蕣狶 9
  7. KAFKA CONSUMER Consumer ྯ稞襑ޞᎣ托奞ጱ襑穩 > Topic > Partition ID >

    Offset Consumer Group ݱPartition虻碘ݝ蒂ቘӞ稞 > Topic 12
  8. SERVICE HEADLESS DNS Client Easy solve L7 load-balancing > K8S

    Service Headless玲஑Podڜ蔭 > Clientᒒ究ਧ揗斉ଘᤍ֖ᗝ 19
  9. JENKINSFILE ਧ嬝PR窕纷 > Prepare ୌ缏๜瑿絑ह㪔㬙ᗟᒫӣො๐率 (MySQL, Redis, mongoDB) 㪔蝢ᎣGitlab樄তPR窕纷牧纔ྊݳ㬫Branch >

    Testing 䁆ᤈUnit Test㪔叨ኞ介手䁭ޞ > Build Image ଘᤈୌ缏ಅ磪盏๐率ጱimage > Deploy Local Service 蟂ᗟಅ磪盏๐率ᛗ๜瑿K8S Cluster > Report ݳ㬫ಅ磪褩ྦྷጱXML介手䁭ޞ㪔൉ԻᛗJenkins > Notification 咳蝑窕纷奾ຎᛗSlack 㪔蝢ᎣGitlab奾๳PR窕纷牧狅䁭ޞฎ玽ݶ఺ݳ㬫 22
  10. JENKINSFILE ਧ嬝㬙ᗟ > Deploy Cloud Service 疥ض獮ಅ磪盏๐率ጱImage Ӥ㯽ᛗPrivate Registery 㪔蟂ᗟಅ磪盏๐率ᛗ

    䌘䛑Branch絑हጱK8S Cluster > Notification 咳蝑窕纷奾ຎᛗSlack 㪔狅奾ຎฎ玽ᥝ䔶ګ蝢Ꭳ ࣁ娄ጱ姘螀Ո㹓౲ૡ纷䒍 (舙०硻K8S๜蛪䨝狶ࢧ笔) 23
  11. NEXT? GitLab + Jira 碉ݳ 萞ኧ秂戢Jira Task翥蒈ᛗGitLab Jira疰胼ࣁGitLab獤ඪcommit, merge碻 ᛔ㵕疥Taskᑏᛗ蒂ቘӾ牏૪ਠ౮

    ਠ珿ጱ㻌֖介手窩荠ሲ 犋㰍㰍ฎᥝ蝢螂Unit Test ইຎྯ稞ݳ㬫獮碉誢介手窩荠ሲ๚Ӥ܋ Ӟ䰬纔ྊPR狶ݳ㬫 Module Proxy Server ྯ稞叨ኞጱ獊碝介手絑ह 襑ᥝӞ㮆揗揣CacheᒫӣොॺկጱProxy Server slack bot 犋ٚ㰍㰍ݝฎ蝢Ꭳ 礍戔Bot Server ಋ㵕᯿珸๐率牏娄Ӥ碍硁翄懯奾ຎ 萞ኧ翄ӞࣁSlackՕᶎӤ砺֢㬵糷玲ݱୗ䁭ޞ 24
  12. MORE CHALLENGE CRD(Custom Resource Definitions) > 疥ग़๐率ਧ嬝傶㻌Ӟ虻რ硯獈K8S or VM >

    仂੝戔ਧ䲆ᓕቘ犖仂੝०藮 > 姘螀Ո㹓ๅ胼䌕ဳෝ碉誢๐率ጱᓕቘ 25