$30 off During Our Annual Pro Sale. View Details »

CloudGarageでServerlessだ!

 CloudGarageでServerlessだ!

2018.3.26 CloudGarage Deep Meetup in Hiroshima のLTスライドです

Yasunari Tanaka

March 26, 2018
Tweet

More Decks by Yasunari Tanaka

Other Decks in Technology

Transcript

  1. 0 CloudGarageServerless 2018/03/26 CloudGarage Deep Meetup in Hiroshima YasunariTanaka(@7richi) #CloudGarage

  2. 1 ,&+! )#-  $(-    *"- 

    '% '%Java     '% Twitter@7richi
  3. 2 (<1PN"GS#38&<)6;WODR"R  ';+3.50#38&<)6;-3:$UBQF 37,.2%<4#,3:</ !1@=YJ!D R !*&<9 SMEH LXE

    TV ! Function-as-a-ServiceBackend-as-a-Service>K !A Z"I 50  FaaS\?C  [] AWS Lambda, Azure Functions, Google Cloud Functions  BaaS AWS AppSync, Firebase(Google) Serverless^
  4. 3 E?8; >J8HIQQQ AWS Lambda, !&<; HI7K6() ,% +'CloudGarageD4Q 5API.!$.!9N

    AM,#/!L :E> 5@*-"!=,#/!3BC 1Q O20CFG P ServerlessD4Q
  5. 4 FaaS Fn Project http://fnproject.io

  6. 5  JavaOne 2017=UVK>?OracleMP JavaB E6.5$6#"6+4#.2&(,61  LD  03%ST"/6(

    Java, Go, Ruby, Python, PHP, and Node.js  !5')*6'- !5')(Dokcer)8;  O< RXfunctionAQ  CLIG:  IF  Function Server8Function9 (Docker on Docker)  & Function Server!5')8 Function!5')N 87@HWCJ Fn ProjectY
  7. 6 Hard Way Hard Way Easy Way

  8. 7 Rancher-D  K35  CloudGarage++: (CPU:1Core, $%':2G, SSD:50G)✕3 

    Docker: +7 0<4B8 =2 ,#+,"  kubeadm : k8s&>G 9;HE4  /I  Flannel : Linux VXLAN?J C, ,)*, :@ ,(  HELM : k8s !,FA,(  Fn Project : .61C ,#+, FaaS
  9. 8      CPU:1Core :2GSSD:50G CloudGarage 

    
  10. 9 Docker  Kubernetescluster [1/6]master  worker  . #

    -
  11. 10 kubelet / kubectl / kubeadm$ &# kubernetes3, Cgroup DriverDockerkubelet6'1

    -2 )( /4 cgroupfs *7  (5 KUBELET_CGROUP_ARGS+. -2) Kubernetescluster0 [2/6]8master"&!%worker"&!9 ESV#KIV WSHEVI "" ESV#KIV M UVEOO # ESV#VTE USRTV#LVVSU GWTO #U LVVSU SEGNEKIU$GORWH$KRRKOI$GRP ESV HRG ESV#NI $KSK ESV#NI EHH # GEV 0 1 IVG ESV URWTGIU$OMUV$H NWFIT IVIU$OMUV HIF LVVS ESV$NWFIT IVIU$MR NWFIT IVIU#ZI MEO PEM 0 1 ESV#KIV WSHEVI ESV#KIV M UVEOO # NWFIOIV NWFIEHP NWFIGVO HRGNIT M R KTIS #M GKTRWS R UYES OMPMV UWSSRTV .KTRWS /TMXIT GKTRWS U GEV IVG U UVIPH U UVIP NWFIOIV$UITXMGI$H &#NWFIEHP$GR KTIS >-0 0=D. >:D < 0 XMTR PI V >-0 0=D. >:D < ##GKTRWS#HTMXIT GKTRWS U 0ZIG<VETV WUT FM NWFIOIV >-0 0=D >-0. 1 D < >-0 0=D<B<=0 D: /<D < >-0 0=D 0= D < >-0 0=D/ <D < >-0 0=D >= CD < >-0 0=D. / < D < >-0 0=D.0 = 1 . =0D < >-0 0=D0A= D < >-0 0=D. >:D <
  12. 11 A OS+" A SWAP%! kubelet   swap%#* A

    kubelet( -  &, A  $master worker ) Kubernetes cluster' [3/6].masterworker/ ## #/ -#0 , EB L L = #/ -#0 , -4 0 # / /0 4 / /= $ $ # /=#= , / - / -4 - 0 $ $ / - 4 / ,4/ ,/4/ / ,4/
  13. 12 > Master % Kubernetes"'- &,#% Flannel  > (/*-)

    worker %.1 !$% $+ 4325 Kubernetes cluster0 [4/6]4master %5 .1-04 2 2 60 1 =6 /20 # # # - 2 1 <1 -0<1 2 1 -00 1 Your Kubernetes master has initialized successfully! … You can now join any number of machines by running the following on each node as root: kubeadm join --token bdcf4d.a3d49e5fe48ff77a <IP>:6443 --discovery-token-ca-cert-hash sha256:2d3c4c4e5c6a1929ad747dd8f5b964e9ff26f6d247770cfdb8c9ee00a0376fce
  14. 13  Flannel#'  kubectl$( *8%)74 /-  conf"&2016 

     .bashrc*898 :+.')&PCkubectl6/-admin.conf"&,3  scp ,3 ')&PC!) ; Kubernetes cluster5 [5/6]:master ); # kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/v0.9.1/Documentation/kube-flannel.yml The connection to the server localhost:8080 was refused - did you specify the right host or port? # cp /etc/kubernetes/admin.conf $HOME/ # chown $(id -u):$(id -g) $HOME/admin.conf # export KUBECONFIG=$HOME/admin.conf export KUBECONFIG=/etc/kubernetes/admin.conf
  15. 14  Master   Worker  Kubernetescluster  [6/6]worker

    # kubeadm join --token bdcf4d.a3d49e5fe48ff77a <IP>:6443 --discovery-token-ca-cert-hash sha256:2d3c4c4e5c6a1929ad747dd8f5b964e9ff26f6d247770cfdb8c9ee00a0376fce
  16. 15  Dashboard KubernetesDashboard [1/3] master  # kubectl apply

    -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes- dashboard.yaml
  17. 16  Dashboard)!*  5;:0 DashboardPodService Accountkubernetes-dashboardAdmin 5;- "**6<SKIP2 9

    cluster-adminClusterRole  kubernetes- dashboard%*$ ClusterRoleBinding/ 8., YAML&(3 kubectl1=47NG> KubernetesDashboard#') [2/3]=)+ ( PC> apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding metadata: name: kubernetes-dashboard labels: k8s-app: kubernetes-dashboard roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-admin subjects: - kind: ServiceAccount name: kubernetes-dashboard namespace: kube-system # kubectl create -f dashboard-admin.yml clusterrolebinding "kubernetes-dashboard" created
  18. 17   PCDashboard   Dashboard  http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/ KubernetesDashboard

     [3/3]  PC # kubectl proxy
  19. 18  HEML  HELM master  # curl -Lo

    /tmp/helm-v2.8.1-linux-amd64.tar.gz https://kubernetes-helm.storage.googleapis.com/helm- v2.8.1-linux-amd64.tar.gz # gunzip helm-v2.8.1-linux-amd64.tar.gz # tar -xvf helm-v2.8.1-linux-amd64.tar # sudo mv l*/helm /usr/local/bin/. # helm init # helm init --upgrade # kubectl create serviceaccount --namespace kube-system tiller # kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube- system:tiller # kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}' # helm search # helm repo update
  20. 19  Fn Project  Function  Fn Project master

      # cd /tmp # git clone https://github.com/fnproject/fn-helm && cd fn-helm # helm dep build fn # helm install --name fm-release fn
  21. 20 Fn ProjectDashboard   

  22. 21 CloudGarage RancherOS 

  23. 22 Easy Way Hard Way Easy Way

  24. 23  -!  TRY Rancher (https://try.rancher.com): Rancher.  Rancher+

    %*  , / Rancher Labs)$.Rancher&#//  CloudGarage: (CPU:2Core, :4G, SSD:100G) (CPU:1Core, :2G, SSD:50G)  Fn Project : "' FaaS Rancher(
  25. 24  TRY Rancher   GitHab   

    k8s    !  #Kuberbetes $% TRY Rancher k8s"
  26. 25  G 0 "0?9   CPU:2Core, (),:4G, SSD:100G

    B=0 "0  CPU:1Core, (),:2G, SSD:50G cluster    RancherOS?9 EFAQHOS(1IRancherOS4?;>6 AF  0 "0 0!1-@Drancher& /1%7<  SSH+0$.0  &1#*02:AISO0'0$ 0 "0 3C6E8 5F CloudGarage0 "0 ?9
  27. 26  k8s k8s [1/2]  CloudGarage   

  28. 27  k8s   k8s  [2/2]

  29. 28    Kubernetescluster

  30. 29  HEML Chart GUI !    

    kubectl CLI  ! Fn Project  [1/2]
  31. 30  kubectl CLI  HemlupdateChartDownload    Function

    Fn Project   # helm init # helm init –upgrade # kubectl create serviceaccount --namespace kube-system tiller # kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube- system:tiller # helm init # cd /tmp # curl -Lo ./master.zip https://github.com/fnproject/fn-helm/archive/master.zip # unzip master.zip # cd ./fn-helm-master # helm dep build fn # helm install --name fm-release fn
  32. 31   jmeter  

  33. 32         

      
  34. 33 

  35. 34 12 Factor App      

     FaaS 
  36. 35 CloudGarage RanchreOS     Ranchre  

    Kubernetes 
  37. 36