So, first of all,
what we need to do is we need to run this command
which you find on the aws-efs-csi-driver
GitHub page, under installation.
This command here needs to be executed.
It basically installed stats driver
in your kubernetes cluster with the Kube + Ctrl command.
So, simply copy this into your command prompt or terminal
and run Kube + Ctrl applied -k
and then this URL.
And this installs this driver into your cluster,
so that you can use it in the future.
Now, with that out of the way
we need to create an elastic file system,
because at least at the moment,
this will not be done automatically for us.
We need to create it ahead of time,
so that we can then use it in our pots.
Therefore go to your AWS console
and there to the EFS service page in a new tab.
Here, we wanna create a new file system
but actually before we do that open yet another new tab
and go to the EC2 to service page here.
And there go to security groups a little bit further below
on the left side here, security groups.
And click on create security group here,
and give it any name of your choice like eks-efs
that's the name I will choose here.
On VPC make sure you choose your eksVPC,
so that this security group,
which allows you to control access
in a certain VPC actually works on the VPC on the network,
which was created for our kubernetes cluster.
Then go to inbound rules and click on add rule.
And here in the dropdown
select the NFS rule
which automatically fills in port 2049 here.
Here on source select custom,
and then here for it is cider range
we need to go back to services, open the VPC service page
and another new tab, and there go to VPCs
and then to your eksVPC,
and then copy this IPV for a cider here,
close that page and paste that here into custom.
And then leave the outbound rules
as they are click create security group.
And I need to add a description here,
so I will just briefly enter something here,
you might want to be a bit more descriptive
than I am here and click create security group.
Now, with that security group created
we can close this page and go back to the EFS service page,
and here click on create file system
there give it any name of your choice,
I will name it eks-efs,
and on the VPC dropdown
of course, choose your eksVPC.
So, the network which was created for your cluster,
so that this file system is part of the same network
your cluster is running in.
Then click on customize, not create but customize
leave all the defaults here though,
but then click on next.
And on this page here on the network access page
to remove the security groups here
for these availability zones
but instead in the security groups drop down,
choose your security group the eks-efs security group
you created in the last step
and do this for both these availability zones,
so that you use the security group you created
in the last step.
Then click next you don't need to enter anything here
for file system policy
and click next again, and then create.
And now this creates a new file system for you,
which you can use as a volume.
Now, copied this file system ID here
because we will need it in a second,
and then let's go back
to our code and into our kubernetes configuration.