Deploy the sonatype-nexus3 helm chart on AWS EKS
TypeScriptTo deploy the Sonatype Nexus3 Helm chart on AWS EKS using Pulumi, we need to perform several steps:
-
Set up an EKS Cluster: We will use the
eks.Cluster
class from the@pulumi/eks
package to create an EKS cluster. This managed Kubernetes service by AWS allows you to run, scale, and secure Kubernetes applications. -
Deploy Nexus using Helm Chart: With the EKS cluster in place, we will deploy Nexus using the
kubernetes.helm.v3.Chart
class from the@pulumi/kubernetes
package which allows us to deploy Helm charts to a Kubernetes cluster.
Here is a program written in TypeScript that accomplishes this:
import * as eks from '@pulumi/eks'; import * as pulumi from '@pulumi/pulumi'; import * as k8s from '@pulumi/kubernetes'; // Create an EKS cluster with default settings. const cluster = new eks.Cluster('my-cluster', {}); // Once the cluster is created, we can deploy Nexus using a Helm chart. // Set up a Kubernetes provider pointing to the Kubeconfig of our EKS cluster. const k8sProvider = new k8s.Provider('k8s-provider', { kubeconfig: cluster.kubeconfig.apply(JSON.stringify), }); // Deploy Nexus using the Helm Chart. const nexusChart = new k8s.helm.v3.Chart( 'nexus', { chart: 'sonatype-nexus', version: '1.2.3', // specify the version of the chart to deploy fetchOpts: { repo: 'https://sonatype.github.io/helm3-charts/', // Nexus Helm repository }, }, { provider: k8sProvider } ); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig;
This program will automate the following:
- Provision an AWS EKS cluster.
- Configure Pulumi to use the cluster's kubeconfig for deploying the Nexus Helm chart to the EKS cluster.
- Deploy the Nexus Helm chart from the official Sonatype repository to the EKS cluster.
Note: Make sure that you have the necessary AWS credentials configured in your environment to create these resources and that
helm
andkubectl
commands are installed and configured to interact with the EKS cluster.After running this pulumi program, your AWS EKS cluster will be set up, and Nexus will be deployed. You can then access the Nexus service by retrieving its external IP or DNS name typically through kubectl, i.e.,
kubectl get svc -n namespace
(replacenamespace
with the namespace where Nexus is deployed, which isdefault
if not specified).-