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

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. 1 ,&+! )#-  $(-    *"- 

    '% '%Java     '% Twitter@7richi
  2. 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^
  3. 3 E?8; >J8HIQQQ AWS Lambda, !&<; HI7K6() ,% +'CloudGarageD4Q 5API.!$.!9N

    AM,#/!L :E> 5@*-"!=,#/!3BC 1Q O20CFG P ServerlessD4Q
  4. 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
  5. 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
  6. 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 <
  7. 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/
  8. 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
  9. 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
  10. 14  Master   Worker  Kubernetescluster  [6/6]worker

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

    -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes- dashboard.yaml
  12. 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
  13. 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
  14. 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
  15. 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(
  16. 24  TRY Rancher   GitHab   

    k8s    !  #Kuberbetes $% TRY Rancher k8s"
  17. 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
  18. 29  HEML Chart GUI !    

    kubectl CLI  ! Fn Project  [1/2]
  19. 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