|
| 1 | += AWS Operator |
| 2 | + |
| 3 | +The AWS Operator allows you to create custom AWS specific resources using |
| 4 | +Kubernetes CRDs or Custom Resource Definitions. These help with defining your |
| 5 | +applications including all the necessary components such as Amazon RDS |
| 6 | +databases, Amazon ElasticCache resources, Amazon SQS queues and many more. |
| 7 | + |
| 8 | +Using the AWS Operator allows your to use processes like `gitops` to keep your |
| 9 | +clusters in a specified state with the internal control loop managing the |
| 10 | +lifecycle of those components. |
| 11 | + |
| 12 | +To make this all possible we merge together Kubernetes CRDs with an operator |
| 13 | +which interacts with Amazon Cloudformation to keep the AWS resources in-sync |
| 14 | +with the control loop. |
| 15 | + |
| 16 | +// TODO: Add demo screen capture |
| 17 | + |
| 18 | +== Getting Started |
| 19 | + |
| 20 | +First thing that you will need to do is install an Pod to IAM management layer |
| 21 | +such as `kube2iam`. This will allow you to create an AWS IAM role that gives |
| 22 | +access to create resources. For an example policy check the |
| 23 | +`examples/iam-policy.json`. |
| 24 | + |
| 25 | +To get started with `kube2iam` go [here](https://github.com/jtblin/kube2iam) |
| 26 | + |
| 27 | +After you have installed `kube2iam` we need to do is deploy the `aws-operator` |
| 28 | +this runs as a pod in your Kubernetes cluster and listen for new CRD's of the |
| 29 | +`aws` type and creates the resource and allocates a kubernetes `Service` to |
| 30 | +connect to it. |
| 31 | + |
| 32 | +You'll want to download the operator file like so |
| 33 | + |
| 34 | +[source,shell] |
| 35 | +---- |
| 36 | +wget https://raw.githubusercontent.com/christopherhein/aws-operator/master/configs/aws-operator.yaml |
| 37 | +---- |
| 38 | + |
| 39 | +Then edit the file and replace `{{POD-ARN}}` with the pod ARN you created for |
| 40 | +`kube2iam` |
| 41 | + |
| 42 | +Last install the manifest with the pod ARN specified. |
| 43 | + |
| 44 | +[source,shell] |
| 45 | +---- |
| 46 | +# Install RBAC |
| 47 | +kubectl apply -f aws-operator.yaml |
| 48 | +---- |
| 49 | + |
| 50 | +To test this create a file like this |
| 51 | + |
| 52 | +[source,yaml] |
| 53 | +---- |
| 54 | +# s3bucket.yml |
| 55 | +apiVersion: operator.aws/v1alpha1 |
| 56 | +kind: S3Bucket |
| 57 | +metadata: |
| 58 | + name: some-name-for-your-bucket |
| 59 | +spec: |
| 60 | + bucketName: some-name-for-your-bucket |
| 61 | + versioning: false |
| 62 | + logging: |
| 63 | + enabled: true |
| 64 | + prefix: "archive" |
| 65 | + tags: |
| 66 | + - key: service |
| 67 | + value: kube |
| 68 | +---- |
| 69 | + |
| 70 | +Then install like you would any other manifest file. |
| 71 | + |
| 72 | +[source,shell] |
| 73 | +---- |
| 74 | +kubectl apply -f s3bucket.yml |
| 75 | +---- |
| 76 | + |
| 77 | +This will communicate directly with Cloudformation to create the S3 bucket using |
| 78 | +the parameters you have passed in. If you'd like to see the progress you can |
| 79 | +view the status directly via `kubectl`. |
| 80 | + |
| 81 | +[source,shell] |
| 82 | +---- |
| 83 | +kubectl get s3buckets <bucket-name> -w |
| 84 | +// TODO: add output. |
| 85 | +---- |
| 86 | + |
| 87 | +To learn more about the other resources please visit the documentation at |
| 88 | +link:/docs/readme.adoc[Documentation] |
| 89 | + |
0 commit comments