Ce diaporama a bien été signalé.
Le téléchargement de votre SlideShare est en cours. ×

Kubernetes CI/CD with Helm

Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité

Consultez-les par la suite

1 sur 22 Publicité

Kubernetes CI/CD with Helm

Télécharger pour lire hors ligne

Checking in your deployment configuration as code

Helm is a tool that streamlines the creation, deployment and management of your Kubernetes-native applications. In this talk, we take a look at how Helm enables you to manage your deployment configurations as code, and demonstrate how it can be used to power your continuous delivery (CI/CD) pipeline.

Checking in your deployment configuration as code

Helm is a tool that streamlines the creation, deployment and management of your Kubernetes-native applications. In this talk, we take a look at how Helm enables you to manage your deployment configurations as code, and demonstrate how it can be used to power your continuous delivery (CI/CD) pipeline.

Publicité
Publicité

Plus De Contenu Connexe

Diaporamas pour vous (20)

Similaire à Kubernetes CI/CD with Helm (20)

Publicité

Plus récents (20)

Kubernetes CI/CD with Helm

  1. 1. Kubernetes CI/CD with Helm: Checking in your deployment configuration as code Adnan Abdulhussein - @prydonius Software Engineer, Bitnami
  2. 2. Agenda Benefits of configuration/infrastructure as code Managing Kubernetes deployments Introduction to Helm Demo CI/CD pipeline with Helm
  3. 3. Configuration and Infrastructure as Code Host Management CI/CD InfrastructurePackaging
  4. 4. Configuration and Infrastructure as Code Why? Version Control Consistent Reproducible Rollbacks Auditing
  5. 5. Tools Source Code Management CI/CD Platform Deployment Tool Orchestration Platform
  6. 6. Kubernetes Resource Definitions MariaDB Service resource Database tier Secret resource Deployment resource Application Service resource Backend tier Config Map resource Deployment resource Nginx Service resource Frontend tier Deployment resource
  7. 7. Example: Kubernetes Resource apiVersion: v1 kind: Deployment metadata: name: my-app spec: replicas: 3 template: metadata: labels: app: my-app spec: containers: - name: my-app image: prydonius/node-todo:v1.0.0 ports: - containerPort: 8080 livenessProbe: httpGet: path: / port: 8080 initialDelaySeconds: 120 timeoutSeconds: 5
  8. 8. Example: Deploying to Kubernetes $ kubectl apply -f ./mariadb-secret.yaml secret "mariadb" configured $ kubectl apply -f ./mariadb-deployment.yaml deployment "mariadb" configured $ kubectl apply -f ./mariadb-service.yaml service "mariadb" configured $ kubectl apply -f ./application-configmap.yaml configmap "application" configured $ kubectl apply -f ./application-deployment.yaml deployment "application" configured $ kubectl apply -f ./application-service.yaml service "application" configured $ kubectl apply -f ./nginx-deployment.yaml deployment "nginx" configured $ kubectl apply -f ./nginx-service.yaml service "nginx" configured
  9. 9. Managing raw manifests can be difficult No template parameterization No application lifecycle hooks No history of releases
  10. 10. Tool for managing resources as a single unit Reuse resources Logically group app resources Manage app lifecycles
  11. 11. Charts (packages) Application definitions Consist of Metadata (Chart.yaml) Kubernetes templates Configuration file (values.yaml) Documentation Can depend on other charts
  12. 12. Navigating a Chart MariaDB Service resource Database tier Secret resource Deployment resource Application Service resource Backend tier Config Map resource Deployment resource Nginx Service resource Frontend tier Deployment resourceDocumentation Metadata Config File helm install my-app
  13. 13. myapp ├── Chart.yaml ├── README.md ├── charts │ └── mariadb-0.5.8.tgz ├── templates │ ├── deployment.yaml │ └── ... └── values.yaml Navigating a Chart
  14. 14. Public charts repository
  15. 15. CLI tool Takes a local Chart path Set parameters used in Chart templates Release state stored in cluster How the Helm can I setup CD?
  16. 16. Generic CI/CD pipeline Code/config change Build Test Publish artifacts Staging/QA Deployment Production Deployment Manual verification
  17. 17. Demo: CI/CD Pipeline Code/config change Build Test Push Docker image Staging/QA Deployment Production Deployment Manual verification
  18. 18. Demo: Todo List App Application Code Dockerfile Jenkinsfile Helm Chart prydonius/node-todo Amazing Todo App ● Express.js server ● Angular frontend ● MongoDB database
  19. 19. Demo
  20. 20. Helm + Jenkins vs. Spinnaker Helm and Jenkins + config as code, single source of truth + multi-branch support (including pull requests) + rich source of plugins + single platform for CI and CD Spinnaker - more deployment strategies
  21. 21. Helm Community Over 100 contributors 1.5 years old Slack channel: Kubernetes/#Helm Public dev meetings: Thursdays @ 9:30 pacific Weekly updates & demos at SIG-Apps meetings: Mondays @ 9am pacific Join us!
  22. 22. Thank youTime for questions and (hopefully) answers...

Notes de l'éditeur

  • Tools that define configuration or infrastructure as code have existed for a long time, such as Chef and Puppet
    More recently we've seen this extend to CI pipelines, packaging with Dockerfiles, Packer config, and Infrastructure on clouds with Terraform and AWS CloudFormation, and more recently with Kubernetes and Helm
  • Single source of truth for all configuration
    Gives you consistency across your deployments and tools
    Declarative definitions allow for reproducibility
    Version control comes with goodies
  • In this talk, we'll take a look at how to build a whole CI/CD pipeline out of these tools
  • In Kubernetes, you would define and create multiple resources for each of these tiers
    Deployment resource - describes what containers to run in the service, how to scale them, healthchecks, resources
    Service resource - enables service discovery and loadbalancing for your deployments
    Secret/ConfigMap resource - your application may take in a password or API token that needs to be kept secret
    Each resource is a declarative definition usually written in YAML or JSON

  • When you want to go and upgrade your templates to release a new version of your application, you need to manually edit these files to change the tag of the docker image
    or if you want to change configuration in the configmap
    this is painful and hard to automate

    after making changes, it's difficult to rollback to a previous state because history is not tracked for every resource

    if your application needs to run a database migration during an upgrade
    you need to build tooling to manage this during your release process
  • Helm allows you to reduce boilerplate and reuse resources in intelligent ways
    e.g. provides a public repository to take common components from
    Bundling different resources together and reordering into dependencies makes resources easier to manage and update
    Helm allows you to hook into your deployments and run database migrations at certain points in the deployment process
  • Packages in Helm are called Charts
    They consist of metadata, templates, config files and docs
    They can depend on other charts
  • Mostly the same as before, but Helm packages this all as a bundle
    Also containers metadata, docs, config file for exposing configuration for your app during install-time
  • Laid out into two chart repos:
    Incubator - great place for sharing and developing ideas, and trying out new k8s alpha features
    Stable - a place for curated, ready-to-run applications
  • Build - Docker
    Test - ???
    Release artifacts - Image registry
    Manual verification - Yes no, maybe so? Staging environment
    Deploy - Production
  • Build - Docker
    Test - ???
    Release artifacts - Image registry
    Manual verification - Yes no, maybe so? Staging environment
    Deploy - Production

×