Skip to content

Création d’un cluster EKS via Crossplane

Installation de Helm et Crossplane

Pour pouvoir accomplir ce tutorial vous aurez besoin au préalable d'avoir un cluster KinD a disposition et Helm installer.

Installation de Helm

We’ll use Helm to install Crossplane on our cluster, so make sure that you have the Helm CLI installed before we can go ahead and add the  Crossplane stable repo. Update the index to pull the latest Helm charts.

curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
[WARNING] Could not find git. It is required for plugin installation.
Downloading https://get.helm.sh/helm-v3.14.0-linux-amd64.tar.gz
Verifying checksum... Done.
Preparing to install helm into /usr/local/bin
helm installed into /usr/local/bin/helm
helm version
version.BuildInfo{Version:"v3.14.0", GitCommit:"3fc9f4b2638e76f26739cd77c7017139be81d0ea", GitTreeState:"clean", GoVersion:"go1.21.5"}
rm get_helm.sh
helm repo add crossplane-stable https://charts.crossplane.io/stable
"crossplane-stable" has been added to your repositories
helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "crossplane-stable" chart repository
Update Complete. ⎈Happy Helming!⎈
helm search repo crossplane
NAME                            CHART VERSION   APP VERSION     DESCRIPTION
crossplane-stable/crossplane    1.14.5          1.14.5          Crossplane is an open source Kubernetes add-on ...
helm install crossplane \
    --namespace crossplane-system \
    --create-namespace \
    crossplane-stable/crossplane
NAME: crossplane
LAST DEPLOYED: Mon Jan 22 10:44:14 2024
NAMESPACE: crossplane-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Release: crossplane

Chart Name: crossplane
Chart Description: Crossplane is an open source Kubernetes add-on that enables platform teams to assemble infrastructure from multiple vendors, and expose higher level self-service APIs for application teams to consume.
Chart Version: 1.14.5
Chart Application Version: 1.14.5

Kube Version: v1.27.3

kubectl get pods -n crossplane-system
NAME                                       READY   STATUS     RESTARTS   AGE
crossplane-76df4b8d9d-6wc4r                1/1     Running   0          26s
crossplane-rbac-manager-75f4c66d5d-z7wrt   1/1     Running   0          26s

kubectl get crds | grep crossplane.io
compositeresourcedefinitions.apiextensions.crossplane.io   2024-01-22T09:44:24Z
compositionrevisions.apiextensions.crossplane.io           2024-01-22T09:44:24Z
compositions.apiextensions.crossplane.io                   2024-01-22T09:44:24Z
configurationrevisions.pkg.crossplane.io                   2024-01-22T09:44:24Z
configurations.pkg.crossplane.io                           2024-01-22T09:44:24Z
controllerconfigs.pkg.crossplane.io                        2024-01-22T09:44:24Z
deploymentruntimeconfigs.pkg.crossplane.io                 2024-01-22T09:44:24Z
environmentconfigs.apiextensions.crossplane.io             2024-01-22T09:44:24Z
functionrevisions.pkg.crossplane.io                        2024-01-22T09:44:24Z
functions.pkg.crossplane.io                                2024-01-22T09:44:24Z
locks.pkg.crossplane.io                                    2024-01-22T09:44:24Z
providerrevisions.pkg.crossplane.io                        2024-01-22T09:44:24Z
providers.pkg.crossplane.io                                2024-01-22T09:44:24Z
storeconfigs.secrets.crossplane.io                         2024-01-22T09:44:24Z
usages.apiextensions.crossplane.io                         2024-01-22T09:44:24Z

Assurez-vous que les pods Crossplane sont opérationnels avant de passer aux étapes suivantes. Certains init containers installeront des custom resource definitions dans votre cluster. Pour vérifier le déploiement, assurez-vous que les pods sont sains et que les CRDs telles que les providers sont installées sur le cluster.

Ajouts du providers EC2

Crossplane recently split the main monolithic AWS provider into multiple smaller providers. Let’s go ahead and Google 'Crossplane providers.' The  best place to explore providers is the official marketplace. Here we have a bunch of providers  for different clouds, including the main one for AWS. All AWS providers follow the same pattern.  'Provider' is the first keyword, then the cloud  in this case, for example, 'AWS,' and then a  particular section such as S3, EC2, etc.

https://marketplace.upbound.io/providers/upbound/provider-aws-ec2/latest

crossplane/providers/proivder-aws-ec2.yaml
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
  name: provider-aws-ec2
spec:
  package: xpkg.upbound.io/upbound/provider-aws-ec2:v0.47.1

kubectl apply -f crossplane/providers/provider-aws-ec2.yaml
provider.pkg.crossplane.io/provider-aws-ec2 created
kubectl get providers
NAME                          INSTALLED   HEALTHY   PACKAGE                                               AGE
provider-aws-ec2              True        True      xpkg.upbound.io/upbound/provider-aws-ec2:v0.47.1      50s
upbound-provider-family-aws   True        True      xpkg.upbound.io/upbound/provider-family-aws:v0.47.1   41s

kubectl get pods -n crossplane-system
NAME                                                        READY   STATUS    RESTARTS   AGE
crossplane-76df4b8d9d-6wc4r                                 1/1     Running   0          23m
crossplane-rbac-manager-75f4c66d5d-z7wrt                    1/1     Running   0          23m
provider-aws-ec2-64262f355830-69ff74789b-8q4tl              1/1     Running   0          2m35s
upbound-provider-family-aws-fec919bd2218-5dd5c4fcb6-klpgg   1/1     Running   0          2m39s

kubectl get crds | grep aws.upbound.io
amicopies.ec2.aws.upbound.io                                   2024-01-22T10:04:49Z
amilaunchpermissions.ec2.aws.upbound.io                        2024-01-22T10:04:49Z
amis.ec2.aws.upbound.io                                        2024-01-22T10:04:49Z
availabilityzonegroups.ec2.aws.upbound.io                      2024-01-22T10:04:49Z
capacityreservations.ec2.aws.upbound.io                        2024-01-22T10:04:49Z
carriergateways.ec2.aws.upbound.io                             2024-01-22T10:04:49Z
customergateways.ec2.aws.upbound.io                            2024-01-22T10:04:49Z
defaultnetworkacls.ec2.aws.upbound.io                          2024-01-22T10:04:49Z
defaultroutetables.ec2.aws.upbound.io                          2024-01-22T10:04:49Z
defaultsecuritygroups.ec2.aws.upbound.io                       2024-01-22T10:04:49Z
defaultsubnets.ec2.aws.upbound.io                              2024-01-22T10:04:50Z
defaultvpcdhcpoptions.ec2.aws.upbound.io                       2024-01-22T10:04:50Z
defaultvpcs.ec2.aws.upbound.io                                 2024-01-22T10:04:50Z
ebsdefaultkmskeys.ec2.aws.upbound.io                           2024-01-22T10:04:50Z
ebsencryptionbydefaults.ec2.aws.upbound.io                     2024-01-22T10:04:50Z
ebssnapshotcopies.ec2.aws.upbound.io                           2024-01-22T10:04:50Z
ebssnapshotimports.ec2.aws.upbound.io                          2024-01-22T10:04:50Z
ebssnapshots.ec2.aws.upbound.io                                2024-01-22T10:04:50Z
ebsvolumes.ec2.aws.upbound.io                                  2024-01-22T10:04:50Z
egressonlyinternetgateways.ec2.aws.upbound.io                  2024-01-22T10:04:50Z
eipassociations.ec2.aws.upbound.io                             2024-01-22T10:04:50Z
eips.ec2.aws.upbound.io                                        2024-01-22T10:04:50Z
flowlogs.ec2.aws.upbound.io                                    2024-01-22T10:04:50Z
hosts.ec2.aws.upbound.io                                       2024-01-22T10:04:50Z
instances.ec2.aws.upbound.io                                   2024-01-22T10:04:50Z
instancestates.ec2.aws.upbound.io                              2024-01-22T10:04:50Z
internetgateways.ec2.aws.upbound.io                            2024-01-22T10:04:50Z
keypairs.ec2.aws.upbound.io                                    2024-01-22T10:04:50Z
launchtemplates.ec2.aws.upbound.io                             2024-01-22T10:04:50Z
mainroutetableassociations.ec2.aws.upbound.io                  2024-01-22T10:04:50Z
managedprefixlistentries.ec2.aws.upbound.io                    2024-01-22T10:04:50Z
managedprefixlists.ec2.aws.upbound.io                          2024-01-22T10:04:50Z
natgateways.ec2.aws.upbound.io                                 2024-01-22T10:04:50Z
networkaclrules.ec2.aws.upbound.io                             2024-01-22T10:04:50Z
networkacls.ec2.aws.upbound.io                                 2024-01-22T10:04:50Z
networkinsightsanalyses.ec2.aws.upbound.io                     2024-01-22T10:04:50Z
networkinsightspaths.ec2.aws.upbound.io                        2024-01-22T10:04:50Z
networkinterfaceattachments.ec2.aws.upbound.io                 2024-01-22T10:04:50Z
networkinterfaces.ec2.aws.upbound.io                           2024-01-22T10:04:50Z
networkinterfacesgattachments.ec2.aws.upbound.io               2024-01-22T10:04:50Z
placementgroups.ec2.aws.upbound.io                             2024-01-22T10:04:50Z
providerconfigs.aws.upbound.io                                 2024-01-22T10:04:48Z
providerconfigusages.aws.upbound.io                            2024-01-22T10:04:48Z
routes.ec2.aws.upbound.io                                      2024-01-22T10:04:50Z
routetableassociations.ec2.aws.upbound.io                      2024-01-22T10:04:50Z
routetables.ec2.aws.upbound.io                                 2024-01-22T10:04:50Z
securitygroupegressrules.ec2.aws.upbound.io                    2024-01-22T10:04:50Z
securitygroupingressrules.ec2.aws.upbound.io                   2024-01-22T10:04:51Z
securitygrouprules.ec2.aws.upbound.io                          2024-01-22T10:04:50Z
securitygroups.ec2.aws.upbound.io                              2024-01-22T10:04:50Z
serialconsoleaccesses.ec2.aws.upbound.io                       2024-01-22T10:04:50Z
snapshotcreatevolumepermissions.ec2.aws.upbound.io             2024-01-22T10:04:50Z
spotdatafeedsubscriptions.ec2.aws.upbound.io                   2024-01-22T10:04:50Z
spotfleetrequests.ec2.aws.upbound.io                           2024-01-22T10:04:51Z
spotinstancerequests.ec2.aws.upbound.io                        2024-01-22T10:04:51Z
storeconfigs.aws.upbound.io                                    2024-01-22T10:04:48Z
subnetcidrreservations.ec2.aws.upbound.io                      2024-01-22T10:04:51Z
subnets.ec2.aws.upbound.io                                     2024-01-22T10:04:51Z
tags.ec2.aws.upbound.io                                        2024-01-22T10:04:51Z
trafficmirrorfilterrules.ec2.aws.upbound.io                    2024-01-22T10:04:51Z
trafficmirrorfilters.ec2.aws.upbound.io                        2024-01-22T10:04:51Z
transitgatewayconnectpeers.ec2.aws.upbound.io                  2024-01-22T10:04:51Z
transitgatewayconnects.ec2.aws.upbound.io                      2024-01-22T10:04:51Z
transitgatewaymulticastdomainassociations.ec2.aws.upbound.io   2024-01-22T10:04:51Z
transitgatewaymulticastdomains.ec2.aws.upbound.io              2024-01-22T10:04:51Z
transitgatewaymulticastgroupmembers.ec2.aws.upbound.io         2024-01-22T10:04:51Z
transitgatewaymulticastgroupsources.ec2.aws.upbound.io         2024-01-22T10:04:51Z
transitgatewaypeeringattachmentaccepters.ec2.aws.upbound.io    2024-01-22T10:04:51Z
transitgatewaypeeringattachments.ec2.aws.upbound.io            2024-01-22T10:04:51Z
transitgatewaypolicytables.ec2.aws.upbound.io                  2024-01-22T10:04:51Z
transitgatewayprefixlistreferences.ec2.aws.upbound.io          2024-01-22T10:04:51Z
transitgatewayroutes.ec2.aws.upbound.io                        2024-01-22T10:04:51Z
transitgatewayroutetableassociations.ec2.aws.upbound.io        2024-01-22T10:04:51Z
transitgatewayroutetablepropagations.ec2.aws.upbound.io        2024-01-22T10:04:51Z
transitgatewayroutetables.ec2.aws.upbound.io                   2024-01-22T10:04:51Z
transitgateways.ec2.aws.upbound.io                             2024-01-22T10:04:51Z
transitgatewayvpcattachmentaccepters.ec2.aws.upbound.io        2024-01-22T10:04:51Z
transitgatewayvpcattachments.ec2.aws.upbound.io                2024-01-22T10:04:51Z
volumeattachments.ec2.aws.upbound.io                           2024-01-22T10:04:51Z
vpcdhcpoptions.ec2.aws.upbound.io                              2024-01-22T10:04:51Z
vpcdhcpoptionsassociations.ec2.aws.upbound.io                  2024-01-22T10:04:51Z
vpcendpointconnectionnotifications.ec2.aws.upbound.io          2024-01-22T10:04:51Z
vpcendpointroutetableassociations.ec2.aws.upbound.io           2024-01-22T10:04:51Z
vpcendpoints.ec2.aws.upbound.io                                2024-01-22T10:04:51Z
vpcendpointsecuritygroupassociations.ec2.aws.upbound.io        2024-01-22T10:04:51Z
vpcendpointserviceallowedprincipals.ec2.aws.upbound.io         2024-01-22T10:04:51Z
vpcendpointservices.ec2.aws.upbound.io                         2024-01-22T10:04:51Z
vpcendpointsubnetassociations.ec2.aws.upbound.io               2024-01-22T10:04:52Z
vpcipampoolcidrallocations.ec2.aws.upbound.io                  2024-01-22T10:04:51Z
vpcipampoolcidrs.ec2.aws.upbound.io                            2024-01-22T10:04:52Z
vpcipampools.ec2.aws.upbound.io                                2024-01-22T10:04:51Z
vpcipams.ec2.aws.upbound.io                                    2024-01-22T10:04:52Z
vpcipamscopes.ec2.aws.upbound.io                               2024-01-22T10:04:52Z
vpcipv4cidrblockassociations.ec2.aws.upbound.io                2024-01-22T10:04:52Z
vpcpeeringconnectionaccepters.ec2.aws.upbound.io               2024-01-22T10:04:52Z
vpcpeeringconnectionoptions.ec2.aws.upbound.io                 2024-01-22T10:04:52Z
vpcpeeringconnections.ec2.aws.upbound.io                       2024-01-22T10:04:52Z
vpcs.ec2.aws.upbound.io                                        2024-01-22T10:04:52Z
vpnconnectionroutes.ec2.aws.upbound.io                         2024-01-22T10:04:52Z
vpnconnections.ec2.aws.upbound.io                              2024-01-22T10:04:52Z
vpngatewayattachments.ec2.aws.upbound.io                       2024-01-22T10:04:52Z
vpngatewayroutepropagations.ec2.aws.upbound.io                 2024-01-22T10:04:52Z
vpngateways.ec2.aws.upbound.io                                 2024-01-22T10:04:52Z

crossplane/aws-credentials.txt
[default]
aws_access_key_id = AKIAPH9Z95R95G2MQ57T
aws_secret_access_key = hKP78ArZ43zwR5Pq6A2F5M33jyyLR9pt5p2Yc6Aw

kubectl create generic aws-secret \
-n crossplane-system \
--from-file=creds=./aws-credentials.txt
secret/aws-secret created

crossplane/providers/provider-aws-config.yaml
apiVersion: aws.upbound.io/v1beta1
kind: ProviderConfig
metadata:
  name: default
spec:
  credentials:
    source: Secret
    secretRef:
      namespace: crossplane-system
      name: aws-secret
      key: creds

kubectl apply -f crossplane/providers/provider-aws-config.yaml
providerconfig.aws.upbound.io/default created

Leave a Reply

Your email address will not be published. Required fields are marked *