Skip to content

Commit 4529781

Browse files
committed
docs: add copy button
1 parent 281e2c9 commit 4529781

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

docs/pages/architecture/access-control.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ There are two ways for an incoming SSH session to get a user identity:
5555
To validate that a user has access, you can use the `kty users check` command.
5656
This is a great way to debug why users are not being allowed to connect.
5757

58-
```bash
58+
```bash copy
5959
kty users check foo@bar.com
6060
```
6161

@@ -66,7 +66,7 @@ bindings added to the cluster. The `kty users grant` command is one way to go
6666
about this, but it is purposely naive. To do something more flexible, you can
6767
check out `kubectl`:
6868

69-
```bash
69+
```bash copy
7070
kubectl create clusterrolebinding foo-bar-com --clusterrole=<my-role> --user=foo@bar.com
7171
```
7272

docs/pages/getting-started.mdx

+10-10
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ As part of this getting started guide, you will:
2525
Binares are available on the [releases page][cli-download]. If you have
2626
homebrew, you can install with:
2727

28-
```bash
28+
```bash copy
2929
brew install grampelberg/kty/kty
3030
```
3131

@@ -47,7 +47,7 @@ In this example, we're using `cluster-admin` because it is everywhere and an
4747
easy way to get started. You can change this to another role, anything with the
4848
[minimum permissions](/architecture/access-control#authorization) in fact. Run:
4949

50-
```bash
50+
```bash copy
5151
kty users grant cluster-admin me@example.com
5252
```
5353

@@ -59,14 +59,14 @@ kty users grant cluster-admin me@example.com
5959
You can verify that this worked and you have the minimum permissions required by
6060
running:
6161

62-
```bash
62+
```bash copy
6363
kty users check me@example.com
6464
```
6565

6666
This command runs a `SelfSubjectAccessReview` against your cluster. If you want
6767
to use `kubectl` instead, you can run:
6868

69-
```bash
69+
```bash copy
7070
kubectl auth can-i list pods --as me@example.com
7171
```
7272

@@ -76,7 +76,7 @@ While it isn't required that you run `kty` on your cluster, it takes care of the
7676
dependencies. To install the server and associated configuration such as
7777
`ClusterRole` and `Service` resources, run:
7878

79-
```bash
79+
```bash copy
8080
kubectl create ns kty && \
8181
kty resources install -n kty
8282
```
@@ -94,15 +94,15 @@ To clean these resources up, you can run `kty resources delete -n kty`.
9494
Verify that this is up and running successfully by checking that the pod has
9595
started up:
9696

97-
```bash
97+
```bash copy
9898
kubectl -n kty rollout status deploy server
9999
```
100100

101101
Once the pod has started up, you'll want to make sure there's an IP address that
102102
can be reached. This will also add `cluster.kty.dev` to your `/etc/hosts` file
103103
so that it is easy to get to the server in the future.
104104

105-
```bash
105+
```bash copy
106106
kubectl -n kty get service server --output=jsonpath='{.status.loadBalancer.ingress[0].ip}' \
107107
| awk '{print $1 " cluster.kty.dev"}' \
108108
| sudo tee -a /etc/hosts
@@ -113,7 +113,7 @@ kubectl -n kty get service server --output=jsonpath='{.status.loadBalancer.ingre
113113
If the load balancer isn't getting a public IP address, there's other ways to
114114
connect to the server. You can port forward using `kubectl`:
115115

116-
```bash
116+
```bash copy
117117
kubectl -n kty port-forward service/server 2222:2222
118118
```
119119

@@ -124,7 +124,7 @@ see what you can do with kty.
124124

125125
## Test it out
126126

127-
```bash
127+
```bash copy
128128
ssh -p 2222 me@cluster.kty.dev
129129
```
130130

@@ -136,7 +136,7 @@ ssh -p 2222 me@cluster.kty.dev
136136

137137
- `scp` some files out of a container:
138138

139-
```bash
139+
```bash copy
140140
scp -P 2222 me@cluster.kty.dev:/default/my-pod/etc/hosts /tmp
141141
```
142142

docs/pages/installation/helm.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Callout } from 'nextra/components'
55
There is a provided `getting-started.yaml` set of values. To install this on
66
your cluster, you can run:
77

8-
```bash
8+
```bash copy
99
helm install kty oci://ghcr.io/grampelberg/helm/kty \
1010
-n kty --create-namespace \
1111
--version $(curl -L https://api.github.com/repos/grampelberg/kty/tags | jq -r '.[0].name' | cut -c2-) \
@@ -15,7 +15,7 @@ helm install kty oci://ghcr.io/grampelberg/helm/kty \
1515
Note: this exposes the kty service externally by default. To get that IP
1616
address, you can run:
1717

18-
```bash
18+
```bash copy
1919
kubectl -n kty get service server --output=jsonpath='{.status.loadBalancer.ingress[0].ip}'
2020
```
2121

docs/pages/usage.mdx

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
To get to the dashboard, you can run:
66

7-
```bash
7+
```bash copy
88
ssh anything@my-remote-host-or-ip -p 2222
99
```
1010

@@ -19,7 +19,7 @@ cluster. The supported resources are `nodes`, `pods` and `services`. See the
1919

2020
To forward port 9090 on your local system to 80 on the cluster, you can run:
2121

22-
```bash
22+
```bash copy
2323
ssh me@my-cluster -p 2222 -L 9090:service/default/remote-service:80
2424
```
2525

@@ -32,13 +32,13 @@ not namespaced, the format is `<resource>/<name>`.
3232
Unlike the API server proxy, this works for any TCP service and is not limited
3333
to HTTP/HTTPS. For example, you can ssh directly to a node in the cluster with:
3434

35-
```bash
35+
```bash copy
3636
ssh me@my-cluster -p 2222 -L 3333:no/my-node:22
3737
```
3838

3939
With that running in one terminal, you can run this in another:
4040

41-
```bash
41+
```bash copy
4242
ssh my-node-username@localhost -p 3333
4343
```
4444

@@ -49,7 +49,7 @@ You can forward a remote service on your cluster to a port on your local host.
4949
To forward port 8080 on service `default/kty` to port `9090` on your local
5050
system, you can run:
5151

52-
```bash
52+
```bash copy
5353
ssh me@my-cluster -p 2222 -R default/kty:8080:localhost:9090
5454
```
5555

@@ -59,13 +59,13 @@ The format for service definitions is `<namespace>/<service-name>`.
5959

6060
The cluster is represented by a file tree:
6161

62-
```bash
62+
```bash copy
6363
/<namespace>/<pod-name>/<container-name>/<file-path>
6464
```
6565

6666
For the `nginx` pod running in `default`, you would do something like:
6767

68-
```bash
68+
```bash copy
6969
scp -P 2222 me@localhost:/default/nginx/nginx/etc/hosts /tmp
7070
```
7171

0 commit comments

Comments
 (0)