Skip to content

Commit

Permalink
doc: Clarify KUBERNETES_POD_NAME and KUBERNETES_NAMESPACE env variabl…
Browse files Browse the repository at this point in the history
…es (#1153)

* and for consistency with rolling updates, optionally use the  KUBERNETES_NAMESPACE
  in kubernetes api discovery
  • Loading branch information
patriknw authored May 19, 2023
1 parent 893c782 commit 3ebff6b
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
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

0 comments on commit 3ebff6b

Please sign in to comment.