-
-
Save junaid18183/08a5ce727af96e92c909fdf30befff32 to your computer and use it in GitHub Desktop.
RKE2 AWS cloud controller manager
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
PUBLIC_IP=$(curl ifconfig.io) | |
# export INSTALL_RKE2_VERSION="v1.20.5+rke2r1" | |
curl -sfL https://get.rke2.io | sh - | |
provider_id="$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone)/$(curl -s http://169.254.169.254/latest/meta-data/instance-id)" | |
mkdir -p /etc/rancher/rke2 | |
cat > /etc/rancher/rke2/config.yaml << EOF | |
node-name: $(hostname -f) | |
write-kubeconfig-mode: "0640" | |
tls-san: | |
- "${PUBLIC_IP}" | |
- "${PUBLIC_IP}.nip.io" | |
kubelet-arg: | |
- cloud-provider=external | |
- provider-id=aws:///$provider_id | |
kube-apiserver-arg: cloud-provider=external | |
kube-controller-manager-arg: cloud-provider=external | |
disable-cloud-controller: true | |
EOF | |
systemctl enable rke2-server | |
systemctl start rke2-server | |
mkdir -p /var/lib/rancher/rke2/server/manifests | |
cat > /var/lib/rancher/rke2/server/manifests/00-aws-ccm.yaml << EOF | |
apiVersion: helm.cattle.io/v1 | |
kind: HelmChart | |
metadata: | |
name: aws-cloud-controller-manager | |
namespace: kube-system | |
spec: | |
chart: aws-cloud-controller-manager | |
repo: https://kubernetes.github.io/cloud-provider-aws | |
version: 0.0.6 | |
targetNamespace: kube-system | |
bootstrap: true | |
valuesContent: |- | |
nodeSelector: | |
node-role.kubernetes.io/master: "true" | |
hostNetworking: true | |
args: | |
- --configure-cloud-routes=false | |
- --v=2 | |
- --cloud-provider=aws | |
EOF | |
cat >> /etc/profile <<EOF | |
export KUBECONFIG=/etc/rancher/rke2/rke2.yaml | |
export CRI_CONFIG_FILE=/var/lib/rancher/rke2/agent/etc/crictl.yaml | |
PATH="$PATH:/var/lib/rancher/rke2/bin" | |
alias k=kubectl | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment