mirror of
https://github.com/labring/sealos.git
synced 2026-09-24 15:46:19 +08:00
add terminal english docs (#2427)
Signed-off-by: 中弈 <fanux@sealos.io> Signed-off-by: 中弈 <fanux@sealos.io>
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 499 KiB After Width: | Height: | Size: 499 KiB |
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
@@ -0,0 +1,115 @@
|
||||
# Cloud terminal tutorial
|
||||
|
||||
Cloud terminal is a web terminal running in the container,
|
||||
and the user's .kube/config has been configured in the terminal,
|
||||
|
||||
It also contains some commonly used commands,
|
||||
which can be used to access almost all APIs of applications that sealos has provided.
|
||||
|
||||
Tips: Currently, persistent files are not supported in the terminal.
|
||||
|
||||
## Access api server
|
||||
|
||||
Kubectl has been installed in the terminal, and the user's kubeconfig has also been configured.
|
||||
|
||||
```shell
|
||||
root@thpqxr0bh:~# kubectl get pod
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
acid-test-0 1/1 Running 0 37m
|
||||
terminal-8b66134e-5294-480f-b6c4-00243fc2488e-5cdc66697c-d5tss 1/1 Running 0 40m
|
||||
```
|
||||
|
||||
.kube/config:
|
||||
|
||||
```shell
|
||||
root@thpqxr0bh:~# cat .kube/config
|
||||
apiVersion: v1
|
||||
clusters:
|
||||
- cluster:
|
||||
server: https://kubernetes.default.svc.cluster.local:443
|
||||
name: kubernetes
|
||||
contexts:
|
||||
- context:
|
||||
cluster: kubernetes
|
||||
user: 8b66134e-5294-480f-b6c4-00243fc2488e
|
||||
namespace: ns-8b66134e-5294-480f-b6c4-00243fc2488e
|
||||
name: 8b66134e-5294-480f-b6c4-00243fc2488e
|
||||
current-context: 8b66134e-5294-480f-b6c4-00243fc2488e
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: 8b66134e-5294-480f-b6c4-00243fc2488e
|
||||
user:
|
||||
token: eyJhbGciOiJSUzI1NiIsImtpZCI6IjItUWxyLUc3X0FiNjF...
|
||||
```
|
||||
|
||||
If you change the server address to https://cloud.sealos.io:6443,
|
||||
you can access the api server remotely, such as using your local terminal,
|
||||
Or integrate into any CI/CD system, just copy the file content to the client's ~.kube/config directory
|
||||
|
||||
## Access Control
|
||||
|
||||
When you try to list cluster nodes:
|
||||
|
||||
```shell
|
||||
root@thpqxr0bh:~# kubectl get node
|
||||
Error from server (Forbidden): nodes is forbidden:
|
||||
User "system:serviceaccount:user-system:8b66134e-5294-480f-b6c4-00243fc2488e"
|
||||
cannot list resource "nodes" in API group "" at the cluster scope
|
||||
```
|
||||
|
||||
Users do not have permission to access.
|
||||
|
||||
## Access other resources
|
||||
|
||||
You can access the database instance through the terminal,
|
||||
or the multi-cluster provided by sealos cloud provider
|
||||
|
||||
```shell
|
||||
root@thpqxr0bh:~# kubectl get infra
|
||||
NAME STATUS AGE AZ
|
||||
aaa Running 3d23h cn-north-1b
|
||||
fanux Running 4d3h cn-north-1b
|
||||
test Running 13d cn-north-1b
|
||||
root@thpqxr0bh:~# kubectl get cluster
|
||||
NAME AGE
|
||||
aaa 3d23h
|
||||
fanux 4d3h
|
||||
test 13d
|
||||
root@thpqxr0bh:~# kubectl get infra
|
||||
NAME STATUS AGE AZ
|
||||
aaa Running 3d23h cn-north-1b
|
||||
fanux Running 4d3h cn-north-1b
|
||||
test Running 13d cn-north-1b
|
||||
```
|
||||
|
||||
Of course, you can also delete or edit these resources.
|
||||
|
||||
## Debugging
|
||||
|
||||
terminal is still a debugging tool,
|
||||
because its is also a pod running under the user ns,
|
||||
and it comes with many network tools.
|
||||
|
||||
```shell
|
||||
root@thpqxr0bh:~# nslookup acid-test
|
||||
Server: 10.96.0.10
|
||||
Address: 10.96.0.10#53
|
||||
|
||||
Name: acid-test.ns-8b66134e-5294-480f-b6c4-00243fc2488e.svc.cluster.local
|
||||
Address: 10.96.2.134
|
||||
|
||||
root@thpqxr0bh:~# ping 10.96.2.134
|
||||
PING 10.96.2.134 (10.96.2.134) 56(84) bytes of data.
|
||||
64 bytes from 10.96.2.134: icmp_seq=1 ttl=64 time=0.048 ms
|
||||
64 bytes from 10.96.2.134: icmp_seq=2 ttl=64 time=0.069 ms
|
||||
```
|
||||
|
||||
## You can even write code in the terminal
|
||||
|
||||

|
||||
```shell
|
||||
root@thpqxr0bh:~# vim main.go
|
||||
root@thpqxr0bh:~# go run main.go
|
||||
hello sealos!
|
||||
```
|
||||
Reference in New Issue
Block a user