Kubernetes¶
__create_image_pull_secret(name, registry, username, password)
¶
🔑 Create an image pull secret for a Docker registry.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Name of the secret. |
required |
registry |
str
|
Docker registry URL. |
required |
username |
str
|
Username for the registry. |
required |
password |
str
|
Password for the registry. |
required |
__init__()
¶
🚀 Initialize the Kubernetes Resource Manager.
Attributes:
Name | Type | Description |
---|---|---|
api_instance |
Core API instance for Kubernetes |
|
apps_api_instance |
Apps API instance for Kubernetes |
|
cluster_name |
Name of the Kubernetes cluster |
|
context_name |
Name of the kubeconfig context |
|
namespace |
Kubernetes namespace |
|
labels |
Labels for Kubernetes resources |
|
annotations |
Annotations for Kubernetes resources |
__wait_for_pod_completion(pod_name, timeout=600, poll_interval=5)
¶
⏳ Wait for a Pod to complete its execution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pod_name |
str
|
Name of the Pod. |
required |
timeout |
int
|
Maximum time to wait in seconds. |
600
|
poll_interval |
int
|
Time between status checks in seconds. |
5
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the Pod succeeded, False otherwise. |
Raises:
Type | Description |
---|---|
TimeoutError
|
If waiting for the Pod times out. |
connect(kube_config_path, cluster_name, context_name, namespace='default', labels={}, annotations={}, api_key=None, api_host=None, verify_ssl=True, ssl_ca_cert=None)
¶
🌐 Connect to a Kubernetes cluster.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
kube_config_path |
str
|
Path to the kubeconfig file. |
required |
cluster_name |
str
|
Name of the Kubernetes cluster. |
required |
context_name |
str
|
Name of the kubeconfig context. |
required |
namespace |
str
|
Kubernetes namespace. |
'default'
|
labels |
dict
|
Labels for Kubernetes resources. |
{}
|
annotations |
dict
|
Annotations for Kubernetes resources. |
{}
|
api_key |
str
|
API key for Kubernetes cluster. |
None
|
api_host |
str
|
API host for Kubernetes cluster. |
None
|
verify_ssl |
bool
|
Whether to verify SSL certificates. |
True
|
ssl_ca_cert |
str
|
Path to the SSL CA certificate. |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
If neither kube_config_path and context_name nor api_key and api_host are provided. |
describe(pod_name)
¶
📝 Describe a Kubernetes pod.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pod_name |
str
|
Name of the pod. |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
V1Pod
|
Description of the pod. |
logs(name, tail=10, follow=True)
¶
📜 Get logs of a Kubernetes pod.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Name of the pod. |
required |
tail |
int
|
Number of lines to tail. |
10
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Logs of the pod. |
run(args)
¶
🚀 Run the Kubernetes resource manager.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
args |
Namespace
|
The parsed command line arguments. |
required |
show()
¶
📋 Show all pods in the namespace.
Returns:
Name | Type | Description |
---|---|---|
list |
List[V1Pod]
|
List of pods. |
status(pod_name)
¶
📜 Get the status of a Pod.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pod_name |
str
|
Name of the Pod. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
V1Pod
|
The status of the Pod. |