You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: Document container temporary credentials and identity integration feature
This commit adds comprehensive documentation for the container temporary
credentials feature introduced in the Container Orchestration Provider. The
documentation covers:
- Container Identity Integration feature in container-orchestration-provider-usage.md
- Configuration parameters (Identity Integration Enabled, Container Permissions)
- Detailed overview of how the feature works
- Complete usage examples in Python, JavaScript, Shell Script
- Best practices and troubleshooting guide
- Updated container-orchestration-provider.md to list Identity Integration
as a key feature
- New how-to-use-temporary-identity-service.md for Java developers
- TemporaryIdentityService API reference
- Usage examples for OSGi bundles
- Best practices and security considerations
- Common use cases including container authentication
- Updated authentication-and-authorization.md with new Temporary Identities section
- Key characteristics of temporary identities
- Differences from regular identities
- API overview and usage example
- Cross-references to related documentation
- Updated mkdocs.yml navigation to include the new Java development guide
The documentation provides developers and users with a complete understanding
of how to leverage temporary credentials for secure container-to-Kura communication.
Copy file name to clipboardExpand all lines: docs/core-services/container-orchestration-provider-usage.md
+295Lines changed: 295 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,6 +90,10 @@ To begin configuring the container, look under **Services** and select the item
90
90
91
91
-**Restart Container On Failure** - A boolean that tells the container engine to automatically restart the container when it has failed or shut down.
92
92
93
+
-**Identity Integration Enabled** - When enabled, Kura automatically creates a temporary identity with the specified permissions and provides the container with authentication credentials to access Kura's REST APIs. See [Container Identity Integration](#container-identity-integration) for more details.
94
+
95
+
-**Container Permissions (optional)** - A comma-separated list of permission names to grant to the container's temporary identity (e.g., `rest.system,rest.configuration`). This field is only used when **Identity Integration Enabled** is set to true. See [Container Identity Integration](#container-identity-integration) for available permissions and usage examples.
96
+
93
97
After specifying container parameters, ensure to set **Enabled** to **true** and press **Apply**. The container engine will then pull the respective image, spin up and start the container. If the gateway or the framework is power cycled, and the container and Container Orchestration Service are set to **enabled**, the framework will automatically start the container again upon startup.
@@ -141,6 +145,297 @@ The result should be a single line with all the existing options plus the new on
141
145
!!! warning
142
146
Modifying the bootloader options incorrectly may prevent the system from booting. Please ensure to back up any important data before making changes to these settings.
143
147
148
+
## Container Identity Integration
149
+
150
+
The Container Identity Integration feature allows containers to securely authenticate and interact with Kura's REST APIs using temporary credentials. When enabled, Kura automatically manages authentication tokens for containers, eliminating the need for manual credential configuration.
151
+
152
+
### Overview
153
+
154
+
When Identity Integration is enabled for a container instance, Kura performs the following operations:
155
+
156
+
1. **Creates a Temporary Identity**: A temporary, non-persistent identity is created specifically for the container with a unique name based on the container name (e.g., `container_myapp` for a container named `myapp`).
157
+
158
+
2. **Assigns Permissions**: The temporary identity is granted the permissions specified in the **Container Permissions** field.
159
+
160
+
3. **Provides Credentials**: The container receives two environment variables:
161
+
- `KURA_IDENTITY_TOKEN`: The authentication token for accessing Kura's REST APIs
162
+
- `KURA_REST_BASE_URL`: The complete base URL for Kura's REST API endpoints (e.g., `http://172.17.0.1:8080/services` or `https://172.17.0.1:443/services`)
163
+
164
+
4. **Automatic Cleanup**: When the container stops or is deleted, Kura automatically removes the temporary identity and invalidates the token.
165
+
166
+
### Features
167
+
168
+
- **Zero Configuration**: Containers automatically receive the correct REST API URL based on the gateway's HTTPS configuration and network mode.
169
+
- **Network-Aware**: The REST base URL is automatically adjusted based on the container's networking mode (bridge, host, etc.).
170
+
- **Secure**: Tokens are temporary and automatically invalidated when containers stop.
171
+
- **Non-Persistent**: Temporary identities exist only in memory and are never persisted to disk.
172
+
- **Permission-Based**: Fine-grained access control using Kura's existing permission system.
173
+
174
+
### Configuration
175
+
176
+
To enable Identity Integration for a container:
177
+
178
+
1. Set **Identity Integration Enabled** to `true`
179
+
2. Specify the required permissions in**Container Permissions** field (comma-separated)
180
+
3. Apply the configuration
181
+
182
+
The framework will create the temporary identity when the container starts and clean it up when the container stops.
183
+
184
+
### Available Permissions
185
+
186
+
The following permissions can be assigned to container identities. Use the exact permission names as shown below:
187
+
188
+
| Permission | Description |
189
+
|------------|-------------|
190
+
|`rest.configuration`| Access to configuration management APIs |
191
+
|`rest.system`| Access to system information and management APIs |
192
+
|`rest.network.configuration`| Access to network configuration APIs |
193
+
|`rest.network.status`| Access to network status information |
194
+
|`rest.deploy`| Access to deployment package management |
195
+
|`rest.cloudconnection`| Access to cloud connection management |
196
+
|`rest.assets`| Access to asset management (Wires) |
197
+
|`rest.wires.admin`| Administrative access to Wires framework |
198
+
|`rest.identity`| Access to identity and permission management |
199
+
|`rest.security`| Access to security-related APIs |
200
+
|`rest.keystores`| Access to keystore management |
201
+
|`rest.command`| Access to command execution APIs |
202
+
|`rest.inventory`| Access to inventory information |
203
+
|`rest.position`| Access to position/GPS information |
204
+
|`kura.admin`| Full administrative access (use with caution) |
205
+
206
+
For a complete list of available permissions, use the [REST Identity API](/references/rest-apis/rest-identity-api-v2/#get-defined-permissions) to query defined permissions in your system.
207
+
208
+
### Usage Examples
209
+
210
+
#### Example 1: Container with Read-Only System Access
211
+
212
+
A monitoring container that needs to read system information but cannot modify configuration:
213
+
214
+
**Container Configuration:**
215
+
- **Identity Integration Enabled**: `true`
216
+
- **Container Permissions**: `rest.system`
217
+
218
+
**Container Code (Python):**
219
+
```python
220
+
import os
221
+
import requests
222
+
223
+
# Read credentials from environment variables
224
+
token = os.environ.get('KURA_IDENTITY_TOKEN')
225
+
base_url = os.environ.get('KURA_REST_BASE_URL')
226
+
227
+
# Make authenticated request to get system information
# Send to external monitoring system or process locally
397
+
# ...
398
+
399
+
time.sleep(60) # Collect every minute
400
+
except Exception as e:
401
+
print(f"Error collecting telemetry: {e}")
402
+
time.sleep(60)
403
+
```
404
+
405
+
### Best Practices
406
+
407
+
1. **Principle of Least Privilege**: Only grant permissions that are absolutely necessary for the container's functionality.
408
+
409
+
2. **Validate Environment Variables**: Always check that `KURA_IDENTITY_TOKEN` and `KURA_REST_BASE_URL` are present before making API calls.
410
+
411
+
3. **Handle Token Lifecycle**: Be prepared for the token to become invalid when the container is stopping or restarting.
412
+
413
+
4. **Error Handling**: Implement proper error handling for API calls, as permissions may be denied if the container doesn't have the required permission.
414
+
415
+
5. **Network Mode Considerations**: The REST base URL is automatically adjusted based on network mode:
416
+
- **bridge mode** (default): Uses the Docker bridge gateway IP (typically `172.17.0.1`)
417
+
- **host mode**: Uses `localhost`
418
+
419
+
6. **HTTPS Support**: The REST base URL automatically uses HTTPS if enabled in Kura's HTTP Service configuration.
420
+
421
+
### Troubleshooting
422
+
423
+
**Container cannot access Kura APIs:**
424
+
- Verify that **Identity Integration Enabled** is set to `true`
425
+
- Check that the container has been granted the necessary permissions in **Container Permissions**
426
+
- Ensure the container is reading the environment variables correctly
427
+
- Check container logs for authentication errors
428
+
429
+
**Token authentication fails:**
430
+
- Verify the token is being sent in the `Authorization` header as `Bearer <token>`
431
+
- Check that the temporary identity was created successfully in Kura logs
432
+
- Ensure the container is using the correct REST base URL
433
+
434
+
**Permission denied errors:**
435
+
- Verify the permission name is correct (case-sensitive)
436
+
- Ensure the permission exists in the system (use the REST Identity API to list defined permissions)
437
+
- Check that the permission was correctly added to the **Container Permissions** field
Copy file name to clipboardExpand all lines: docs/core-services/container-orchestration-provider.md
+11-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,4 +2,14 @@
2
2
3
3
The Container Orchestration Provider allows Kura to manage Docker. With this tool, you can arbitrarily pull and deploy containerized software packages and run them on your gateway. This Service allows the user to create, configure, start, and stop containers all from the browser. The bundle will also restart containers if the gateway is restarted.
4
4
5
-
The feature is composed of two bundles, one that exposes APIs for container management and one that implements those APIs. This API is exposed so that you can leverage it to implement containerization in your own Kura plugins.
5
+
The feature is composed of two bundles, one that exposes APIs for container management and one that implements those APIs. This API is exposed so that you can leverage it to implement containerization in your own Kura plugins.
6
+
7
+
## Key Features
8
+
9
+
-**Container Lifecycle Management**: Create, start, stop, and manage Docker containers through Kura's web interface
10
+
-**Image Management**: Pull images from Docker Hub or authenticated registries with automatic retry and timeout configuration
11
+
-**Resource Control**: Configure CPU, memory, GPU allocation, and cgroup settings for containers
12
+
-**Network Configuration**: Support for various Docker networking modes (bridge, host, custom networks)
13
+
-**Security**: Container image signature verification and allowlist enforcement
14
+
-**Identity Integration**: Automatic provisioning of temporary credentials for containers to securely access Kura's REST APIs
15
+
-**Persistence**: Automatic container restart after gateway reboot if configured
0 commit comments