Skip to content

Instantly share code, notes, and snippets.

@iosifnicolae2
Last active June 30, 2023 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iosifnicolae2/6ca3b2b6c4dcbb1bc5cec6863ac9a203 to your computer and use it in GitHub Desktop.
Save iosifnicolae2/6ca3b2b6c4dcbb1bc5cec6863ac9a203 to your computer and use it in GitHub Desktop.
Deploy RKE2 Kuberentes cluster in Rancher behind HTTP_PROXY
  • setup the machine pool

image

image

User Data

#cloud-config
package_update: true
apt:
  http_proxy: http://10.3.0.2:8080
  https_proxy: http://10.3.0.2:8080
packages:
  - qemu-guest-agent
runcmd:
  - - systemctl
    - enable
    - '--now'
    - qemu-guest-agent.service
# Uncomment the below lines so you can login easier using dev-password as password and ubuntu as user
#password: dev-password
#chpasswd: {expire: False}
#ssh_pwauth: True

write_files:
- path: /etc/environment
  content: |
    http_proxy=http://10.3.0.2:8080
    https_proxy=http://10.3.0.2:8080
    HTTP_PROXY=http://10.3.0.2:8080
    HTTPS_PROXY=http://10.3.0.2:8080
    NO_PROXY=localhost,127.0.0.1,0.0.0.0,10.0.0.0/8,cattle-system.svc,192.168.10.0/24,.svc,.cluster.local
  append: true
# TODO: replace 10.3.0.2:8080 with your own proxy
# The reason why I've added also lowercase env variables was to have proxy configured for curl

Network Data

"network":
  "version": 2
  "ethernets":
    "enp1s0":
      "dhcp4": true
      "mtu": 1400
# OBS. It's important to set mtu to 1400 if your using VLANs
  • add also the poxy configs to Cluster configuration > Agent Environment Vars

image

Obs.

If you're deploying on Harvester, make sure that Harvester VIP is accessible from the selected VM network as these requests are not using http_proxy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment