DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Enterprise AI Trend Report: Gain insights on ethical AI, MLOps, generative AI, large language models, and much more.

2024 Cloud survey: Share your insights on microservices, containers, K8s, CI/CD, and DevOps (+ enter a $750 raffle!) for our Trend Reports.

PostgreSQL: Learn about the open-source RDBMS' advanced capabilities, core components, common commands and functions, and general DBA tasks.

AI Automation Essentials. Check out the latest Refcard on all things AI automation, including model training, data security, and more.

Related

  • Containerization and AI: Streamlining the Deployment of Machine Learning Models
  • Container Security: The Art and Science of Safeguarding Cloud-Native Environments
  • How To Use KubeDB and Postgres Sidecar for Database Integrations in Kubernetes
  • Composite Container Patterns in K8S From a Developer's Perspective

Trending

  • Secure Your API With JWT: Kong OpenID Connect
  • Maximizing Developer Efficiency and Productivity in 2024: A Personal Toolkit
  • Exploring the Frontiers of AI: The Emergence of LLM-4 Architectures
  • Modern Python: Patterns, Features, and Strategies for Writing Efficient Code (Part 1)
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Deploy Kubernetes Resources in a Controlled and Orderly Manner

Deploy Kubernetes Resources in a Controlled and Orderly Manner

Sveltos can help you solve this problem by allowing you to specify the order in which Kubernetes resources are deployed.

By 
Gianluca Mardente user avatar
Gianluca Mardente
·
Aug. 31, 23 · Tutorial
Like (1)
Save
Tweet
Share
5.6K Views

Join the DZone community and get the full member experience.

Join For Free

When deploying Kubernetes resources in a cluster, it is sometimes necessary to deploy them in a specific order. For example, a Custom Resource Definition (CRD) must exist before any custom resources of that type can be created.

Sveltos can help you solve this problem by allowing you to specify the order in which Kubernetes resources are deployed.

ClusterProfile Order

A ClusterProfile is a Kubernetes custom resource definition (CRD) that defines the resources that you want to deploy on a set of Kubernetes clusters.

ClusterProfile allows customers to define an order:

  • Using the helmCharts field: The helmCharts field allows you to specify a list of Helm charts that need to be deployed. Sveltos will deploy the Helm charts in the order that they are listed in this field.
  • Using the policyRefs field: The policyRefs field allows you to reference a list of ConfigMap and Secret resources whose contents need to be deployed. Sveltos will deploy the resources in the order that they are listed in this field.

Here are some examples:

  • The following ClusterProfile will first deploy the Prometheus Helm chart and then the Grafana Helm chart:
YAML
 
apiVersion: config.projectsveltos.io/v1alpha1
kind: ClusterProfile
metadata:
  name: prometheus-grafana
spec:
  clusterSelector: env=fv
  syncMode: Continuous
  helmCharts:
  - repositoryURL:    https://prometheus-community.github.io/helm-charts
    repositoryName:   prometheus-community
    chartName:        prometheus-community/prometheus
    chartVersion:     23.4.0
    releaseName:      prometheus
    releaseNamespace: prometheus
    helmChartAction:  Install
  - repositoryURL:    https://grafana.github.io/helm-charts
    repositoryName:   grafana
    chartName:        grafana/grafana
    chartVersion:     6.58.9
    releaseName:      grafana
    releaseNamespace: grafana
    helmChartAction:  Install


Resource Deployment Order With Events

In some cases, it is necessary to deploy Kubernetes resources only after other resources are in a healthy state. For example, a job that creates a table in a database should not be deployed until the database deployment is healthy.

Sveltos can help you solve this problem by allowing you to use events to control the rollout of your application.

An event is a notification that is sent when a certain condition is met. For example, you could create an event that is sent when the database deployment becomes healthy.

You can then use this event to trigger the deployment of the job that creates the table in the database.

By using events, you can ensure that your application is rolled out in a controlled and orderly manner.

order how manifests are applied to the cluster

In the above example, Sveltos has been instructed to:

  1. Deploy PostgreSQL deployment and service
  2. Wait for PostgreSQL deployment to be ready
  3. Deploy a job that creates a table in the DB
  4. Wait for the job to be completed
  5. Deploy todo-app, which can access PostgreSQL deployment
  6. Wait for the todo-app to be healthy
  7. Deploy a Job that adds an entry to the database via todo-app


All YAMLs for this example can be found in the projectsveltos documentation.

Support This Project

I hope you enjoyed this article! If you did, please check out the GitHub repo for the project. The repo contains the code, documentation, and examples, so it’s a great resource for getting started. 

You can also star the project if you find it helpful.

Thank you for reading!

Grafana Kubernetes PostgreSQL Container

Published at DZone with permission of Gianluca Mardente. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Containerization and AI: Streamlining the Deployment of Machine Learning Models
  • Container Security: The Art and Science of Safeguarding Cloud-Native Environments
  • How To Use KubeDB and Postgres Sidecar for Database Integrations in Kubernetes
  • Composite Container Patterns in K8S From a Developer's Perspective

Partner Resources


Comments

ABOUT US

  • About DZone
  • Send feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: