Skip to content

Commit

Permalink
[CN-1306] add docs for workload identity (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
kutluhanmetin authored Jul 24, 2024
1 parent 8c978c0 commit f4dd18d
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 22 deletions.
5 changes: 5 additions & 0 deletions docs/modules/ROOT/examples/service-account.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: hazelcast.com/v1alpha1
kind: Hazelcast
metadata:
name: hazelcast
serviceAccountName: myServiceAccount
1 change: 1 addition & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* xref:advanced-networking.adoc[Advanced Networking]
* xref:tls.adoc[Configuring TLS]
* xref:user-code-namespaces.adoc[User Code Namespaces]
* xref:authorization.adoc[Authorization Methods to Access Cloud Storage]
* Data Pipelines
** xref:jet-engine-configuration.adoc[Configuring the Jet Engine]
** xref:jet-job-configuration.adoc[Running Data Pipelines]
Expand Down
92 changes: 92 additions & 0 deletions docs/modules/ROOT/pages/authorization.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
= Authorization Methods to Access Cloud Storage

You can use either a secret or Service Accounts to access your cloud storage, as detailed below.

== Using Secrets

You can create a secret to access cloud provider resources. You can find the secret creation examples for different cloud providers in the next sections:

=== Accessing Resources on AWS

[source,shell]
----
kubectl create secret generic <secret-name> \
--from-literal=region=<region> \
--from-literal=access-key-id=<access-key-id> \
--from-literal=secret-access-key=<secret-access-key>
----

See https://docs.aws.amazon.com/sdk-for-go/api/aws/session/[AWS Session] to learn about the authentication procedure.

=== Accessing Resources on GCP

[source,bash]
----
kubectl create secret generic <secret-name> \
--from-file=google-credentials-path=<service_account_json_file>
----

See https://cloud.google.com/docs/authentication/production/[Application Default Credentials] to learn about the authentication procedure.

=== Accessing Resources on Azure

[source,bash]
----
kubectl create secret generic <secret-name> \
--from-literal=storage-account=<storage-account> \
--from-literal=storage-key=<storage-key>
----

See https://docs.microsoft.com/en-us/azure/storage/common/storage-account-keys-manage?tabs=azure-portal/[Azure Storage Account Keys] to learn about the authentication procedure.

== Using Service Accounts

You can use `Service Accounts` to access cloud provider resources without providing `secretName` in `HotBackup`, `JetJob`, `UCN` custom resources. To use this approach, you must provide `serviceAccountName` in your Hazelcast CR.

.Example of Service Account Configuration
[source,yaml,subs="attributes+"]
----
include::ROOT:example$/service-account.yaml[]
----

=== Accessing GCP Resources using Workload Identity
Google Kubernetes Engine (GKE) Workload Identity is a feature that allows you to map a Kubernetes Service Account to a Google Cloud IAM (Identity and Access Management) Service Account so that users can manage pods permissions using IAM.

Create a Service Account using the following command:

[source,shell]
----
kubectl create serviceaccount myServiceAccount --namespace <NAMESPACE>
----

To use it, you must annotate the service account you created with the following command:

[source,shell]
----
kubectl annotate serviceaccount myServiceAccount \
--namespace <NAMESPACE> \
iam.gke.io/gcp-service-account=<GCP_SA_NAME>@<GCP_PROJECT>.iam.gserviceaccount.com
----

See https://cloud.google.com/docs/authentication#service-accounts[Service Accounts] to learn more about it.

=== Accessing AWS Resources using IAM Roles for Service Accounts
IAM roles for service accounts is a feature that allows you to map a Kubernetes Service Account to an AWS IAM Role so that users can manage pods permissions using IAM.

Create a Service Account using the following command:

[source,shell]
----
kubectl create serviceaccount myServiceAccount --namespace <NAMESPACE>
----

To use it, you must annotate the service account you created with the following command:

[source,shell]
----
kubectl annotate serviceaccount myServiceAccount \
--namespace <NAMESPACE> \
eks.amazonaws.com/role-arn=arn:aws:iam::<AWS_ACCOUNT_ID>:role/my-role
----

See https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html[IAM Roles for Service Accounts] to learn more about it.
24 changes: 3 additions & 21 deletions docs/modules/ROOT/pages/backup-restore.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,7 @@ External backup in AWS S3:
include::ROOT:example$/hot-backup-external-aws.yaml[]
----
See https://docs.aws.amazon.com/sdk-for-go/api/aws/session/[AWS Session] to learn about authentication procedure.
[source,bash]
----
kubectl create secret generic <secret-name> \
--from-literal=region=<region> \
--from-literal=access-key-id=<access-key-id> \
--from-literal=secret-access-key=<secret-access-key>
----
NOTE: For further information about accessing resources on different cloud providers, see xref:authorization.adoc[Authorization Methods to Access Cloud Provider Resources].
--
GCP::
Expand All @@ -86,12 +79,7 @@ External backup in GCP Bucket:
include::ROOT:example$/hot-backup-external-gcp.yaml[]
----
See https://cloud.google.com/docs/authentication/production/[Application Default Credentials] to learn about authentication procedure.
[source,bash]
----
kubectl create secret generic <secret-name> \
--from-file=google-credentials-path=<service_account_json_file>
----
NOTE: For further information about accessing resources on different cloud providers, see xref:authorization.adoc[Authorization Methods to Access Cloud Provider Resources].
--
Azure::
Expand All @@ -103,13 +91,7 @@ External backup in Azure Blob:
include::ROOT:example$/hot-backup-external-azure.yaml[]
----
See https://docs.microsoft.com/en-us/azure/storage/common/storage-account-keys-manage?tabs=azure-portal/[Azure Storage Account Keys] to learn about authentication procedure.
[source,bash]
----
kubectl create secret generic <secret-name> \
--from-literal=storage-account=<storage-account> \
--from-literal=storage-key=<storage-key>
----
NOTE: For further information about accessing resources on different cloud providers, see xref:authorization.adoc[Authorization Methods to Access Cloud Provider Resources].
--
====
<1> The bucket URI where backup data will be stored in
Expand Down
5 changes: 4 additions & 1 deletion docs/modules/ROOT/pages/jet-job-configuration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,7 @@ The following `JetJob` resource runs the Data Pipeline for the `Hazelcast` resou
.Example configuration
[source,yaml,subs="attributes+"]
----
include::ROOT:example$/jet-job-example.yaml[]
include::ROOT:example$/jet-job-example.yaml[]
----

NOTE: For further information about accessing resources on different cloud providers, see xref:authorization.adoc[Authorization Methods to Access Cloud Provider Resources].
6 changes: 6 additions & 0 deletions docs/modules/ROOT/pages/user-code-namespaces.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ User Code Namespaces in AWS S3:
----
include::ROOT:example$/user-code-namespace-aws.yaml[]
----
NOTE: For further information about accessing resources on different cloud providers, see xref:authorization.adoc[Authorization Methods to Access Cloud Provider Resources].
--
GCP::
Expand All @@ -40,6 +42,8 @@ User Code Namespaces in GCP:
----
include::ROOT:example$/user-code-namespace-gcp.yaml[]
----
NOTE: For further information about accessing resources on different cloud providers, see xref:authorization.adoc[Authorization Methods to Access Cloud Provider Resources].
--
Azure::
Expand All @@ -50,6 +54,8 @@ User Code Namespaces in Azure Blob:
----
include::ROOT:example$/user-code-namespace-azure.yaml[]
----
NOTE: For further information about accessing resources on different cloud providers, see xref:authorization.adoc[Authorization Methods to Access Cloud Provider Resources].
--
====
<1> The bucket URI in which to store backup data
Expand Down

0 comments on commit f4dd18d

Please sign in to comment.