diff --git a/.gitignore b/.gitignore index dcac261..da1f77e 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,5 @@ pnpm-debug.log* package-lock.json bun.lockb yarn.lock + +.vscode \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5687b03..fc4012e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -91,7 +91,7 @@ importers: specifier: ^2.13.0 version: 2.13.1 sharp: - specifier: ^0.33.0 + specifier: ^0.33.5 version: 0.33.5 svelte: specifier: ^4.2.19 diff --git a/src/content/posts/2024-10-24_k3s_ansible/index.md b/src/content/posts/2024-10-24_k3s_ansible/index.md index 53e976e..7a7c9a8 100644 --- a/src/content/posts/2024-10-24_k3s_ansible/index.md +++ b/src/content/posts/2024-10-24_k3s_ansible/index.md @@ -5,7 +5,7 @@ description: '' image: '' tags: [] category: '' -draft: false +draft: true lang: '' --- ## Preparación del escenario @@ -57,3 +57,26 @@ chmod 600 "$KUBECONFIG" sudo k3s kubectl config view --raw > "$KUBECONFIG" ``` +una vez instalado kubernetes, copiamos la configuración de kubernetes del plano de control a nuestro kubeconfig : + +```shell +export KUBECONFIG=~/.kube/config +mkdir ~/.kube 2> /dev/null +chmod 600 "$KUBECONFIG" +ssh -i .vagrant/machines/plano-control/virtualbox/private_key vagrant@192.168.56.10 'sudo k3s kubectl config view --raw' > ~/.kube/config +``` + +y en el fichero modificamos la ip de localhost por la de la máquina: +```shell +sed -i 's/127\.0\.0\.1/192\.168\.56\.10/g' $KUBECONFIG +``` + +Finalmente podemos usar kubectl. + +```shell +❯ kubectl get nodes +NAME STATUS ROLES AGE VERSION +nodo1 Ready 15m v1.30.5+k3s1 +nodo2 Ready 14m v1.30.5+k3s1 +plano-control Ready control-plane,master 15m v1.30.5+k3s1 +``` \ No newline at end of file