or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing
xxxxxxxxxx
Checking expiry of Secrets in the clusters
Introduction
airshipctl secret check-certificate-expiration
checks for all the expirable secret and certificate entities in the cluster and reports back to the operatorBasically, there are three different types of entities identified
Explanation
TLS Secrets in the cluster
The tls secrets are a type of Kubernetes secrets with 'Type' set as 'kubernetes.io/tls'. This is basically the TLS CA and the resultant certificates related secrets which will be applied/used in the Management and the Workload CAPI clusters
Workload Cluster kubeconfig secret
This secret gets created while deploying the Workload cluster and is named as
cluster-name
-kubeconfigThe base64 decoded content of the secret value is basically a kubeconfig which is used to connect to the Workload Cluster. The kubeconfig contains the expirable contents of cluster and the user certificate information
Workload Cluster node certificates
When a Workload Cluster is deployed, control plane nodes and worker nodes gets created. These are nothing but a normal Kubernetes cluster nodes and hence has the certificate content in /etc/kubernetes/pki directory for each node. These certificate's expiry information needs to be identified
Implementation
airshipctl secret check-certificate-expiration
command has been introduced to manage all the above 3 conditions.Working
TLS Secrets in the cluster
The command just runs through all the TLS secrets in the cluster and checks if any of the crt is within the duration and if so, displays it
Workload Cluster kubeconfig secret
The command fetches all the secrets suffixed with
-kubeconfig
and checks its association with a Workload cluster by looking for a kubeadmcontrolplane reference, fetches the 'value' field, base64 decodes it and checks for the certificate expiryWorkload Cluster node certificates
Communicating and fetching some contents in the Workload nodes is tricky. Hence, an Ansible Operator called HOSTCONFIG operator has been introduced as part of a different work item and the same is leveraged here. The Ansible operator runs like a cron job inside one of the control plane nodes (reconcile period can be set in days), fetches the expiry information using
kubeadm alpha certs check-expiration
command and annotates each node with its certificate-expiry information.airshipctl secret check-certificate-expiration
just reads the annotation, parses it and displays if the limit is within the duration.airshipctl secret check-certificate-expiration