Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Spring Into Kubernetes DFW

50 vues

Publié le

Dallas Spring Connect Presentation by Paul Czarkowski

Publié dans : Marketing
  • Soyez le premier à commenter

  • Soyez le premier à aimer ceci

Spring Into Kubernetes DFW

  1. 1. © Copyright 2018 Pivotal Software, Inc. All rights Reserved. Paul Czarkowski pczarkowski@pivotal.io Twitter: @pczarkowski Spring into Kubernetes
  2. 2. © Copyright 2018 Pivotal Software, Inc. All rights Reserved. Paul Czarkowski pczarkowski@pivotal.io Twitter: @pczarkowski Spring into Kubernetes
  3. 3. Register Today Use Discount Code S1P_Save200 October 7–10, 2019 Austin Convention Center and Save!
  4. 4. Operations is the Secret sauce (just not traditional operations)
  5. 5. Operations as a Competitive Advantage
  6. 6. APP APP APP APP Production
  7. 7. Platforms
  8. 8. Traditional Ticket Based Human Toil Build App Artifact Build App Container(s) App → to the Platform Container Runtime Container Hosts CaaS Container Orchestrator PaaS Application Platform Infrastructure Platform Container Platform Application Platform Infrastructure As Code More Control Less Control Less Efficiency More Efficiency IaaS API CF API K8s API Config Management Deployment Manifest IaaS Hardware Platform PXE boot ? 9 ????? PaaS Application Platform Function Platform ??? API
  9. 9. Traditional Ticket Based Human Toil Build App Artifact Build App Container(s) App → to the Platform Container Runtime Container Hosts CaaS Container Orchestrator PaaS Application Platform VMware aws/gce/azure Pivotal Container Service Pivotal App Service Infrastructure As Code Pivotal Cloud Foundry 2.0 More Control Less Control Less Efficiency More Efficiency IaaS API CF API K8s API Config Management Deployment Manifest IaaS Dell Or whatever PXE boot ? 10 ????? PaaS Application Platform Pivotal Function Service ??? API
  10. 10. App → to the Platform PaaS Application Platform Pivotal App Service Pivotal Cloud Foundry 2.0 More Control Less Control Less Efficiency More Efficiency CF API 11 APP APP APP APP cf push
  11. 11. Build App Container(s) CaaS Container Orchestrator Pivotal Container Service Pivotal Cloud Foundry 2.0 More Control Less Control Less Efficiency More Efficiency K8s API Deployment Manifest 12 APP APP APP APP
  12. 12. Containers
  13. 13. Saurabh Gupta. "Containers and Pivotal Cloud Foundry" 2016.
  14. 14. FROM maven:3.6-jdk-11-slim as BUILD COPY . /src WORKDIR /src RUN mvn install -DskipTests FROM openjdk:11.0.1-jre-slim-stretch EXPOSE 8080 WORKDIR /app ARG JAR=hello-0.0.1-SNAPSHOT.jar COPY --from=BUILD /src/target/$JAR /app.jar ENTRYPOINT ["java","-jar","/app.jar"]
  15. 15. $ docker build -t paulczar/hello . $ docker push paulczar/hello $ docker pull paulczar/hello $ docker run -d -p 8080:8080 paulczar/hello
  16. 16. Kubernetes
  17. 17. Master Master Master API Server Users Control Plane Data Plane etcd Cloud Ctrl Manager Worker Kubelet kube-proxy docker Scheduler Controller Manager Worker Kubelet kube-proxy docker Worker Kubelet kube-proxy docker Flannel Flannel Flannel
  18. 18. Controllers
  19. 19. Desired State Actual State
  20. 20. Vs
  21. 21. Unix Philosophy: Do one thing. Do it well.
  22. 22. $ kubectl
  23. 23. Imperative $ kubectl run hello --image=paulczar/go-hello-world $ kubectl scale hello --replicas=3 $ kubectl create service clusterip hello --tcp=80:80
  24. 24. Declarative $ kubectl apply -f hello-world.yaml
  25. 25. Declarative Vs Imperative
  26. 26. manifests
  27. 27. apiVersion: v1 kind: Pod metadata: name: hello spec: containers: - image: paulczar/go-hello-world imagePullPolicy: Always name: hello
  28. 28. Resources
  29. 29. ● Pods ● Services ● Volumes
  30. 30. POD
  31. 31. one or more containers that share a network and storage
  32. 32. the minimum scalable unit of your application
  33. 33. MASTER Node 1 Node 2 Node 3 Node 4 hello kubelet kubelet kubelet kubelet Scheduler Pod Name: hello Image: hello1
  34. 34. MASTER Node 1 Node 2 Node 3 Node 4 hello kubelet kubelet kubelet kubelet Scheduler hello Pod Name: hello Image: hello1
  35. 35. MASTER Node 1 Node 2 Node 3 Node 4 hello kubelet kubelet kubelet kubelet Scheduler Pod Name: hello Image: hello1
  36. 36. Replica Set
  37. 37. MASTER Node 1 Node 2 Node 3 Node 4 hello-a kubelet kubelet kubelet kubelet Scheduler Controller Manager Replica Set Name: hello Image: hello1 Size: 3 hello-ghello-s Pod Name: hello-a Image: hello1 Pod Name: hello-b Image: hello1 Pod Name: hello-c Image: hello1
  38. 38. MASTER Node 1 Node 2 Node 3 Node 4 hello-a kubelet kubelet kubelet kubelet Scheduler Controller Manager Replica Set Name: hello Image: hello1 Size: 3 hello-ghello-s hello-d Pod Name: hello-a Image: hello1 Pod Name: hello-b Image: hello1 Pod Name: hello-d Image: hello1
  39. 39. MASTER Node 1 Node 2 Node 3 Node 4 hello-a kubelet kubelet kubelet kubelet Scheduler Controller Manager Replica Set Name: hello Image: hello1 Size: 5 hello-ghello-s hello-d hello-t hello-z Pod Name: hello-a Image: hello1 Pod Name: hello-a Image: hello1 Pod Name: hello-a Image: hello1 Pod Name: hello-a Image: hello1 Pod Name: hello-a Image: hello1
  40. 40. MASTER Node 1 Node 2 Node 3 Node 4 kubelet kubelet kubelet kubelet Scheduler Controller Manager Replica Set Name: hello Image: hello1 Size: 0
  41. 41. Deployment
  42. 42. MASTER Node 1 Node 2 Node 3 Node 4 hello-A-c kubelet kubelet kubelet kubelet Scheduler Controller Manager Deployment Name: hello Image: hello1 Size: 3 hello-A-ghello-A-s Replica Set Name: hello-A Image: hello1 Size: 3
  43. 43. MASTER Node 1 Node 2 Node 3 Node 4 hello-A-c kubelet kubelet kubelet kubelet Scheduler Controller Manager Deployment Name: hello Image: hello2 Size: 3 hello-A-ghello-A-s Replica Set Name: hello-A Image: hello1 Size: 3 Replica Set Name: hello-B Image: hello2 Size: 3 hello-B-g hello-B-r hello-B-c
  44. 44. MASTER Node 1 Node 2 Node 3 Node 4 kubelet kubelet kubelet kubelet Scheduler Controller Manager Deployment Name: hello Image: hello2 Size: 3 Replica Set Name: hello-A Image: hello1 Size: 0 Replica Set Name: hello-B Image: hello2 Size: 3 hello-B-g hello-B-r hello-B-c
  45. 45. StatefulSet
  46. 46. MASTER Node 1 Node 2 Node 3 Node 4 hello-1 kubelet kubelet kubelet kubelet Scheduler Controller Manager StatefulSet Name: db Image: hello1 Size: 3 Pod Name: hello-1 Image: hello1
  47. 47. MASTER Node 1 Node 2 Node 3 Node 4 hello-1 kubelet kubelet kubelet kubelet Scheduler Controller Manager StatefulSet Name: hello Image: hello1 Size: 3 hello-2 Pod Name: hello-1 Image: hello1 Pod Name: hello-2 Image: hello1
  48. 48. MASTER Node 1 Node 2 Node 3 Node 4 hello-1 kubelet kubelet kubelet kubelet Scheduler Controller Manager StatefulSet Name: hello Image: hello1 Size: 3 hello-3hello-2 Pod Name: hello-1 Image: hello1 Pod Name: hello-2 Image: hello1 Pod Name: hello-3 Image: hello1
  49. 49. MASTER Node 1 Node 2 Node 3 Node 4 db-1 kubelet kubelet kubelet kubelet Scheduler Controller Manager StatefulSet Name: db Image: cassandra Size: 3 db-3db-2 Pod Name: hello-a Image: Pod Name: hello-b Image: Pod Name: db-1 Image: ... vol vol vol Pod Name: hello-a Image: Pod Name: hello-b Image: PVC Name: db-1 Image: ...
  50. 50. $ kubectl
  51. 51. $ kubectl run hello --image=paulczar/hello -- port=8080
  52. 52. ● kubectl run created a deployment “deployments.apps/hello” NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE deployment.apps/hello 1 1 1 1 1m ● The deployment created a replicaset “replicaset.apps/hello-64f6bf9dd4” NAME DESIRED CURRENT READY AGE replicaset.apps/hello-64f6bf9dd4 1 1 1 1m ● Which created a pod “pod/hello-64f6bf9dd4-tq5dq” NAME READY STATUS RESTARTS AGE pod/hello-64f6bf9dd4-tq5dq 1/1 Running 0 2s
  53. 53. $ kubectl scale --replicas=3 deployment/hello
  54. 54. $ kubectl scale --replicas=3 deployment/hello deployment.extensions/hello scaled $ kubectl get all NAME READY STATUS RESTARTS AGE pod/hello-64f6bf9dd4-2bndq 1/1 Running 0 15m pod/hello-64f6bf9dd4-4kq9l 0/1 ContainerCreating 0 2s pod/hello-64f6bf9dd4-8lkcs 1/1 Running 0 5s NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE deployment.apps/hello 3 3 2 3 16m NAME DESIRED CURRENT READY AGE replicaset.apps/hello-64f6bf9dd4 3 3 2 16m
  55. 55. $ kubectl edit deployment hello ... spec: containers: - env: - name: MESSAGE value: HELLO I LOVE YOU!!!! image: paulczar/go-hello imagePullPolicy: Always name: hello
  56. 56. $ kubectl get all NAME READY STATUS RESTARTS AGE pod/hello-5c75b546c7-4lwnn 1/1 Running 0 1m pod/hello-5c75b546c7-bwxxq 1/1 Running 0 1m pod/hello-5c75b546c7-sl2pg 1/1 Running 0 1m NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE deployment.apps/hello 3 3 3 3 23m NAME DESIRED CURRENT READY AGE replicaset.apps/hello-5c75b546c7 3 3 3 1m replicaset.apps/hello-64f6bf9dd4 0 0 0 23m
  57. 57. $ kubectl port-forward deployment/hello 8080 Forwarding from 127.0.0.1:8080 -> 8080 $ curl localhost:8080 <html><head><title>HELLO I LOVE YOU!!!!</title></head><body>HELLO I LOVE YOU!!!!!</body></html>
  58. 58. Service
  59. 59. $ kubectl expose deployment hello --type=LoadBalancer --port 80 --target-port 8080
  60. 60. kubectl expose deployment hello ● creates a service with a ClusterIP that acts as an internal loadbalancer to all pods in the “hello” deployment --type=LoadBalancer ● Creates a NodePort ● Configures a LoadBalancer to access the pods via the NodePort $ kubectl get services NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE hello LoadBalancer 10.39.248.123 35.184.17.129 80:30468/TCP 5m $ curl 35.184.17.129 <html><head><title>HELLO I LOVE YOU!!!!</title></head><body>HELLO I LOVE YOU!!!!!</body></html>
  61. 61. Service track Pods based on metadata and provides connectivity and service discovery (DNS, Env variables) for them. Type ClusterIP (default) exposes service on a cluster-internal IP. Container Container Pod app=bacon Container Container Pod app=bacon Service app=bacon 10.3.55.7
  62. 62. Service track Pods based on metadata and provides connectivity and service discovery (DNS, Env variables) for them. Type NodePort extends ClusterIP to expose services on each node’s IP via a static port. Container Container Pod app=bacon Container Container Pod app=bacon Service app=bacon 10.3.55.7 192.168.0.5:4530 K8s Worker K8s Worker 192.168.0.6:4530
  63. 63. Service track Pods based on metadata and provides connectivity and service discovery (DNS, Env variables) for them. Type LoadBalancer extends NodePort to configure a cloud provider’s load balancer using the cloud-controller-manager. Container Container Pod app=bacon Container Container Pod app=bacon Service app=bacon 10.3.55.7 192.168.0.5:4530 K8s Worker K8s Worker 192.168.0.6:4530 Load Balancer 33.6.5.22:80
  64. 64. Ingress a controller that manages an external entity to provide load balancing, SSL termination and name-based virtual hosting to services based on a set of rules. Ingress Service app=bacon https://example.com Service app=eggs /bacon /eggs
  65. 65. Volume
  66. 66. Container Container Pod Volume Is [effectively] a Directory, possibly with data in it, available to all containers in a Pod. Usually Shares lifecycle of a Pod (Created when Pod is created, destroyed when Pod is destroyed). Persistent Volumes outlive Pods. Can be mounted from local disk, or from a network storage device such as a EBS volume, iscsi, NFS, etc.
  67. 67. Config Map / Secret
  68. 68. $ kubectl create configmap hello --from-literal=’message=Hello S1T’
  69. 69. kubectl create configmap hello --from-file=index.html ● creates a configmap called “hello” containing the contents index.html $ kubectl get configmap hello -o yaml apiVersion: v1 kind: ConfigMap metadata: name: hello data: index.html: "<html>n<head>nt<title>Hello to my friends</title>n</head>n<body>ntHello to my friendsn</body>n</html>nn"
  70. 70. kubectl create secret generic hello --from-file=index.html ● creates a secret called “hello” containing a base64 hash of contents index.html $ kubectl get secret hello -o yaml apiVersion: v1 kind: Secret metadata: name: hello data: index.html: PGh0bWw+CjxoZWFkPgoJPHRpdGxlPkhlbGxvIHRvIG15IGZyaWVuZHM8L3RpdGxlPgo8L2hlYWQ+Cjxib2R5 PgoJSGVsbG8gdG8gbXkgZnJpZW5kcwo8L2JvZHk+CjwvaHRtbD4KCg==
  71. 71. Provides key-value pairs to be injected into a pod much like user-data is injected into a Virtual Machine in the cloud. Allows you to do last minute configuration of applications running on Kubernetes such as setting a database host, or a admin password. ConfigMaps store values as strings, Secrets store them as byte arrays (serialized as base64 encoded strings). Secrets are [currently] not encrypted by default. This is likely to change. Can be injected as files in a Volume, or as Environment Variables. ConfigMaps/Secrets (user-data)
  72. 72. Helm
  73. 73. Helm is the best way to find, share, and use software built for Kubernetes
  74. 74. custom load balancer Chart.yaml Values.yaml templates/ ci services db
  75. 75. Discover & launch great Kubernetes-ready apps Search charts 555 charts ready to deploy Wordpress, Jenkins, Kubeless... Secure | https://hub.helm.sh
  76. 76. apiVersion: v1 kind: ConfigMap metadata: name: {{ .Chart.name }}-cm data: db: {{ .Value.db }} apiVersion: apps/v1beta1 kind: Deployment metadata: name: {{ .Chart.name }}-app labels: app: {{ .Chart.name }} ... ... spec: containers: - image: paulczar/hello name: hello volumeMounts: - name: config mountPath: /etc/hello volumes: - name: config configMap: name: {{ .Chart.name }}-cm apiVersion: v1 kind: Service metadata: name: {{ .Chart.name }}-svc labels: app: {{ .Chart.name }}-world spec: ports: - port: {{ .Value.port }} protocol: TCP targetPort: 8080 selector: app: {{ .Chart.name }}-world type: NodePort
  77. 77. $ helm install --name staging . --set db=’user:pass@staging.mysql/dbname’ $ helm install --name production . --set db=’user:pass@production.mysql/dbname’
  78. 78. $ helm create
  79. 79. Spinnaker
  80. 80. https://medium.com/netflix-techblog/announcing-ribbon-tying-the-netflix-mid -tier-services-together-a89346910a62
  81. 81. https://giphy.com/gifs/frustrated-keyboard-g8GfH3i5F0hby @pczarkowski
  82. 82. https://unsplash.com/photos/WHWYBmtn3_0 @pczarkowski
  83. 83. + @pczarkowski
  84. 84. APP APP APP APP @pczarkowski
  85. 85. Cluster Management ● Server Group ● Cluster ● Applications ● Load Balancer ● Firewall Pipelines ● Pipeline ● Stage ● Deployment Strategies @pczarkowski
  86. 86. Multi-Cloud Inventory ● Server Group ● Cluster ● Applications ● Load Balancer ● Firewall Actions and Reactions ● Pipeline ● Stage ● Deployment Strategies @pczarkowski
  87. 87. @pczarkowski
  88. 88. Cluster Management ● Server Group ● Cluster ● Applications ● Load Balancer ● Firewall Deployment Management ● Pipeline ● Stage ● Deployment Strategies Deployment Strategies
  89. 89. Spinnaker Cloud API App App App @pczarkowski
  90. 90. @pczarkowski
  91. 91. Halyard https://en.wikipedia.org/wiki/Halyard
  92. 92. @pczarkowski
  93. 93. Transforming How The World Builds Software © Copyright 2019 Pivotal Software, Inc. All rights Reserved.
  94. 94. Twitter: @pczarkowski Video: https://youtu.be/zzBUpDS7pmY Slides: check your email © Copyright 2019 Pivotal Software, Inc. All rights Reserved.

×