Skip to content

Instantly share code, notes, and snippets.

@dbones
Last active July 17, 2022 20:51
Show Gist options
  • Save dbones/77ad77ce5a220205724429e125ff5ba6 to your computer and use it in GitHub Desktop.
Save dbones/77ad77ce5a220205724429e125ff5ba6 to your computer and use it in GitHub Desktop.
k3d-example
k3d cluster create --config ./config.yaml
kubectl -n cattle-system patch deployments cattle-cluster-agent --patch '{
"spec": {
"template": {
"spec": {
"hostAliases": [
{
"hostnames":
[
"{{ rancher_server_hostname }}"
],
"ip": "{{ rancher_server_ip }}"
}
]
}
}
}
}'
kubectl -n cattle-system patch daemonsets cattle-node-agent --patch '{
"spec": {
"template": {
"spec": {
"hostAliases": [
{
"hostnames":
[
"{{ rancher_server_hostname }}"
],
"ip": "{{ rancher_server_ip }}"
}
]
}
}
}
}'
# k3d configuration file, saved as e.g. /home/me/myk3dcluster.yaml
apiVersion: k3d.io/v1alpha2 # this will change in the future as we make everything more stable
kind: Simple # internally, we also have a Cluster config, which is not yet available externally
name: prod # name that you want to give to your cluster (will still be prefixed with `k3d-`)
# servers: 1 # same as `--servers 1`
# agents: 3 # same as `--agents 3`
ports:
- port: 31443:443
nodeFilters:
- loadbalancer
- port: 31080:8080
nodeFilters:
- loadbalancer
- port: 41002:40002
nodeFilters:
- loadbalancer
- port: 41003:40003
nodeFilters:
- loadbalancer
- port: 41004:40004
nodeFilters:
- loadbalancer
- port: 41005:40005
nodeFilters:
- loadbalancer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment