Skip to content

Commit

Permalink
fix: use absolute path to rke2's kubectl binary
Browse files Browse the repository at this point in the history
ensures that cluster-etcd secret can be created if host does not have kubectl installed

fixes rancher#403

Signed-off-by: Simplysoft GmbH <1588210+simplysoft@users.noreply.github.com>
  • Loading branch information
simplysoft committed Aug 13, 2024
1 parent 480a96d commit 9d1641a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bootstrap/internal/cloudinit/controlplane_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ runcmd:
- '/opt/rke2-cis-script.sh'{{ end }}
- 'systemctl enable rke2-server.service'
- 'systemctl start rke2-server.service'
- 'kubectl create secret tls cluster-etcd -o yaml --dry-run=client -n kube-system --cert=/var/lib/rancher/rke2/server/tls/etcd/server-ca.crt --key=/var/lib/rancher/rke2/server/tls/etcd/server-ca.key --kubeconfig /etc/rancher/rke2/rke2.yaml | kubectl apply -f- --kubeconfig /etc/rancher/rke2/rke2.yaml'
- '/var/lib/rancher/rke2/bin/kubectl create secret tls cluster-etcd -o yaml --dry-run=client -n kube-system --cert=/var/lib/rancher/rke2/server/tls/etcd/server-ca.crt --key=/var/lib/rancher/rke2/server/tls/etcd/server-ca.key --kubeconfig /etc/rancher/rke2/rke2.yaml | /var/lib/rancher/rke2/bin/kubectl apply -f- --kubeconfig /etc/rancher/rke2/rke2.yaml'
- 'mkdir -p /run/cluster-api'
- '{{ .SentinelFileCommand }}'
{{- template "commands" .PostRKE2Commands }}
Expand Down
4 changes: 2 additions & 2 deletions bootstrap/internal/ignition/ignition.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ var (
"setenforce 0",
"systemctl enable rke2-server.service",
"systemctl start rke2-server.service",
"kubectl create secret tls cluster-etcd -o yaml --dry-run=client -n kube-system " +
"/var/lib/rancher/rke2/bin/kubectl create secret tls cluster-etcd -o yaml --dry-run=client -n kube-system " +
"--cert=/var/lib/rancher/rke2/server/tls/etcd/server-ca.crt --key=/var/lib/rancher/rke2/server/tls/etcd/server-ca.key " +
"--kubeconfig /etc/rancher/rke2/rke2.yaml |" +
" kubectl apply -f- --kubeconfig /etc/rancher/rke2/rke2.yaml",
" /var/lib/rancher/rke2/bin/kubectl apply -f- --kubeconfig /etc/rancher/rke2/rke2.yaml",
"restorecon /etc/systemd/system/rke2-server.service",
"mkdir -p /run/cluster-api /etc/cluster-api",
"echo success | tee /run/cluster-api/bootstrap-success.complete /etc/cluster-api/bootstrap-success.complete > /dev/null",
Expand Down

0 comments on commit 9d1641a

Please sign in to comment.