Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: Clarify KUBERNETES_POD_NAME and KUBERNETES_NAMESPACE env variables #1153

Merged
merged 1 commit into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions discovery-kubernetes-api/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ akka.discovery {
#
# Set this value to a specific string to override discovering the namespace using pod-namespace-path.
pod-namespace = "<pod-namespace>"
pod-namespace = ${?KUBERNETES_NAMESPACE}

# Domain of the k8s cluster
pod-domain = "cluster.local"
Expand Down
10 changes: 9 additions & 1 deletion docs/src/main/paradox/bootstrap/kubernetes-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ The following configuration is required:

The lookup needs to know which namespace to look in. By default, this will be detected by reading the namespace
from the service account secret, in `/var/run/secrets/kubernetes.io/serviceaccount/namespace`, but can be overridden by
setting `akka.discovery.kubernetes-api.pod-namespace`.
setting `akka.discovery.kubernetes-api.pod-namespace` or by providing `KUBERNETES_NAMESPACE` environment variable.

```yaml
env:
- name: KUBERNETES_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
```

For more details on how to configure the Kubernetes deployment see @ref:[recipes](recipes.md).

32 changes: 32 additions & 0 deletions docs/src/main/paradox/rolling-updates.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,26 @@ The following configuration is required, more details for each and additional co

* `akka.rollingupdate.kubernetes.pod-name`: this can be provided by setting `KUBERNETES_POD_NAME` environment variable to `metadata.name` on the Kubernetes container spec.

```yaml
env:
- name: KUBERNETES_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
```

Additionally, the pod annotator needs to know which namespace the pod belongs to. By default, this will be detected by reading the namespace
from the service account secret, in `/var/run/secrets/kubernetes.io/serviceaccount/namespace`, but can be overridden by
setting `akka.rollingupdate.kubernetes.namespace` or by providing `KUBERNETES_NAMESPACE` environment variable.

```yaml
env:
- name: KUBERNETES_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
```

#### Role based access control

@@@ warning
Expand Down Expand Up @@ -217,10 +233,26 @@ The following configuration is required, more details for each and additional co

* `akka.rollingupdate.kubernetes.pod-name`: this can be provided by setting `KUBERNETES_POD_NAME` environment variable to `metadata.name` on the Kubernetes container spec.

```yaml
env:
- name: KUBERNETES_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
```

Additionally, the pod annotator needs to know which namespace the pod belongs to. By default, this will be detected by reading the namespace
from the service account secret, in `/var/run/secrets/kubernetes.io/serviceaccount/namespace`, but can be overridden by
setting `akka.rollingupdate.kubernetes.namespace` or by providing `KUBERNETES_NAMESPACE` environment variable.

```yaml
env:
- name: KUBERNETES_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
```

#### Role based access control

Make sure to provide access to corresponding rbac rules `apiGroups` and `resources` like this:
Expand Down