cmd/kgctl: use KUBECONFIG from env
This commit is contained in:
parent
5865cefbfa
commit
72991949ac
@ -99,7 +99,7 @@ EOF
|
||||
This configuration can then be applied to a local WireGuard interface, e.g. `wg0`, with the help of the `kgctl` tool:
|
||||
|
||||
```shell
|
||||
kgctl --kubeconfig=$KUBECONFIG showconf peer squat > peer.ini
|
||||
kgctl showconf peer squat > peer.ini
|
||||
sudo wg setconf wg0 peer.ini
|
||||
```
|
||||
|
||||
@ -111,7 +111,7 @@ The topology of a Kilo network can be analyzed using the `kgctl` binary.
|
||||
For example, the `graph` command can be used to generate a graph of the network in Graphviz format:
|
||||
|
||||
```shell
|
||||
kgctl graph --kubeconfig=$KUBECONFIG | twopi -Tsvg > cluster.svg
|
||||
kgctl graph | twopi -Tsvg > cluster.svg
|
||||
```
|
||||
|
||||
<img src="./cluster.svg">
|
||||
|
@ -116,7 +116,7 @@ func main() {
|
||||
}
|
||||
cmd.PersistentFlags().StringVar(&backend, "backend", k8s.Backend, fmt.Sprintf("The backend for the mesh. Possible values: %s", availableBackends))
|
||||
cmd.PersistentFlags().StringVar(&granularity, "mesh-granularity", string(mesh.DataCenterGranularity), fmt.Sprintf("The granularity of the network mesh to create. Possible values: %s", availableGranularities))
|
||||
cmd.PersistentFlags().StringVar(&kubeconfig, "kubeconfig", "", "Path to kubeconfig.")
|
||||
cmd.PersistentFlags().StringVar(&kubeconfig, "kubeconfig", os.Getenv("KUBECONFIG"), "Path to kubeconfig.")
|
||||
cmd.PersistentFlags().StringVar(&subnet, "subnet", "10.4.0.0/16", "CIDR from which to allocate addressees to WireGuard interfaces.")
|
||||
|
||||
for _, subCmd := range []*cobra.Command{
|
||||
|
@ -31,7 +31,7 @@ Now, the `kgctl` tool can be used to generate the WireGuard configuration for th
|
||||
|
||||
```shell
|
||||
PEER=squat
|
||||
kgctl --kubeconfig=$KUBECONFIG showconf peer $PEER
|
||||
kgctl showconf peer $PEER
|
||||
```
|
||||
|
||||
This will produce some output like:
|
||||
@ -47,7 +47,7 @@ The configuration can then be applied to a local WireGuard interface, e.g. `wg0`
|
||||
|
||||
```shell
|
||||
IFACE=wg0
|
||||
kgctl --kubeconfig=$KUBECONFIG showconf peer $PEER > peer.ini
|
||||
kgctl showconf peer $PEER > peer.ini
|
||||
sudo wg setconf $IFACE peer.ini
|
||||
```
|
||||
|
||||
@ -55,7 +55,7 @@ Finally, in order to access the cluster, the client will need appropriate routes
|
||||
For example, on a Linux machine, the creation of these routes could be automated by running:
|
||||
|
||||
```shell
|
||||
for ip in $(kgctl --kubeconfig=$KUBECONFIG showconf peer $PEER | grep AllowedIPs | cut -f 3- -d ' ' | tr -d ','); do
|
||||
for ip in $(kgctl showconf peer $PEER | grep AllowedIPs | cut -f 3- -d ' ' | tr -d ','); do
|
||||
sudo ip route add $ip dev $IFACE
|
||||
done
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user