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

feature/add rotate ca docs #80

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Changes from 8 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
65 changes: 65 additions & 0 deletions content/en/docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,68 @@ in the result, you’ll receive the tenant-kubeconfig file, which you can provid
Here you can find reference repository to learn how to configure Cozystack services using GitOps approach:

- https://github.com/aenix-io/cozystack-gitops-example

### How to rotate CA
klinch0 marked this conversation as resolved.
Show resolved Hide resolved

#### For tenant k8s cluster:

```bash
export NAME=k8s-cluster-name
kubectl delete secret ${NAME}-ca
kubectl delete secret ${NAME}-sa-certificate

kubectl delete secret ${NAME}-api-server-certificate
kubectl delete secret ${NAME}-api-server-kubelet-client-certificate
kubectl delete secret ${NAME}-datastore-certificate
kubectl delete secret ${NAME}-front-proxy-client-certificate
kubectl delete secret ${NAME}-konnectivity-certificate

kubectl delete secret ${NAME}-admin-kubeconfig
kubectl delete secret ${NAME}-controller-manager-kubeconfig
kubectl delete secret ${NAME}-konnectivity-kubeconfig
kubectl delete secret ${NAME}-scheduler-kubeconfig

k delete po -l app.kubernetes.io/name=kamaji -n cozy-kamaji
```

Wait for virt-launcher-kubernetes-* pods restart.
Download new k8s certificate.

klinch0 marked this conversation as resolved.
Show resolved Hide resolved
#### For managment k8s cluster:
See talos docs: https://www.talos.dev/v1.9/advanced/ca-rotation/#kubernetes-api
```bash
git clone https://github.com/aenix-io/cozystack.git
cd packages/core/testing
make apply
make exec
```

Add to your talosconfig in pod:
```yaml
client-aenix-new:
endpoints:
- 12.34.56.77
- 12.34.56.78
- 12.34.56.79
nodes:
- 12.34.56.77
- 12.34.56.78
- 12.34.56.79
```

Exec in pod:
```bash
talosctl rotate-ca -e 12.34.56.77,12.34.56.78,12.34.56.79 --control-plane-nodes 12.34.56.77,12.34.56.78,12.34.56.79 --talos=false --dry-run=false &
```

Get new kubeconfig:
```bash
talm kubeconfig kubeconfig -f nodes/srv1.yaml
```
klinch0 marked this conversation as resolved.
Show resolved Hide resolved

#### For talos API
See: https://www.talos.dev/v1.9/advanced/ca-rotation/#talos-api
All like for managment k8s cluster, but talosctl command:
```bash
talosctl rotate-ca -e 12.34.56.77,12.34.56.78,12.34.56.79 --control-plane-nodes 12.34.56.77,12.34.56.78,12.34.56.79 --kubernetes=false --dry-run=false &
```
klinch0 marked this conversation as resolved.
Show resolved Hide resolved