知乎专栏 |
帮助信息
[root@localhost ~]# rancher Rancher CLI, managing containers one UTF-8 character at a time Usage: rancher [OPTIONS] COMMAND [arg...] Version: v2.4.13 Options: --debug Debug logging --config value, -c value Path to rancher config (default: "/root/.rancher") [$RANCHER_CONFIG_DIR] --help, -h show help --version, -v print the version Commands: apps, [app] Operations with apps. Uses helm. Flags prepended with "helm" can also be accurately described by helm documentation. catalog Operations with catalogs clusters, [cluster] Operations on clusters context Operations for the context globaldns Operations on global DNS providers and entries inspect View details of resources kubectl Run kubectl commands login, [l] Login to a Rancher server multiclusterapps, [multiclusterapp mcapps mcapp] Operations with multi-cluster apps namespaces, [namespace] Operations on namespaces nodes, [node] Operations on nodes projects, [project] Operations on projects ps Show workloads in a project server Operations for the server settings, [setting] Show settings for the current server ssh SSH into a node up apply compose config wait Wait for resources cluster, app, project, multiClusterApp token Authenticate and generate new kubeconfig token help, [h] Shows a list of commands or help for one command Run 'rancher COMMAND --help' for more information on a command.
链接到 Rancher
$ rancher login https://<SERVER_URL> --token <BEARER_TOKEN>
登陆演示
[root@localhost ~]# rancher login https://192.168.30.13 --token token-5q6kw:8b7w2hj85z7cwkwhhvjlp2rw5ls5n8d4gj7vj74jbdch9gv4dzq9km The authenticity of server 'https://192.168.30.13' can't be established. Cert chain is : [Certificate: Data: Version: 3 (0x2) Serial Number: 5708461865883058034 (0x4f3887d281d2bf72) Signature Algorithm: ECDSA-SHA256 Issuer: O=dynamiclistener-org,CN=dynamiclistener-ca Validity Not Before: Nov 29 07:00:54 2021 UTC Not After : Nov 29 08:53:00 2022 UTC Subject: O=dynamic,CN=dynamic Subject Public Key Info: Public Key Algorithm: ECDSA Public-Key: (256 bit) X: 1c:f4:1d:86:32:a7:57:6c:d5:6c:59:86:18:b9:9f: 40:10:e2:f2:99:96:04:96:10:d4:88:82:2c:06:5c: e7:7c Y: 16:86:d8:41:0a:f3:c3:f0:e7:0c:29:a4:69:e0:b2: 41:34:73:a6:78:58:e0:a0:df:84:4d:c9:9e:83:3f: bd:fd Curve: P-256 X509v3 extensions: X509v3 Key Usage: critical Digital Signature, Key Encipherment X509v3 Extended Key Usage: TLS Web Server Authentication X509v3 Authority Key Identifier: keyid:3D:40:3F:96:30:78:9F:C1:84:1F:94:E0:A2:4D:1C:E1:69:3D:F3:E4 X509v3 Subject Alternative Name: DNS:localhost, DNS:rancher.cattle-system IP Address:127.0.0.1, IP Address:172.19.0.3, IP Address:192.168.30.13 Signature Algorithm: ECDSA-SHA256 30:45:02:21:00:e5:f1:e7:2d:14:fc:25:1f:5c:ea:ce:9a:8d: 7a:95:e2:d8:bc:64:7a:38:83:3e:84:bc:2e:c7:83:5c:44:5f: 21:02:20:7c:91:46:fe:2f:bc:f9:18:41:e7:8d:70:0b:1b:c7: e3:c2:b3:12:c5:4f:44:ef:fa:00:15:88:6c:3a:c2:e1:23 ] Do you want to continue connecting (yes/no)? yes INFO[0002] Saving config to /root/.rancher/cli2.json
配置文件
[root@localhost ~]# cat /root/.rancher/cli2.json | jq { "Servers": { "rancherDefault": { "accessKey": "token-5q6kw", "secretKey": "8b7w2hj85z7cwkwhhvjlp2rw5ls5n8d4gj7vj74jbdch9gv4dzq9km", "tokenKey": "token-5q6kw:8b7w2hj85z7cwkwhhvjlp2rw5ls5n8d4gj7vj74jbdch9gv4dzq9km", "url": "https://192.168.30.13", "project": "local:p-8rzzk", "cacert": "-----BEGIN CERTIFICATE-----\nMIIBpzCCAU2gAwIBAgIBADAKBggqhkjOPQQDAjA7MRwwGgYDVQQKExNkeW5hbWlj\nbGlzdGVuZXItb3JnMRswGQYDVQQDExJkeW5hbWljbGlzdGVuZXItY2EwHhcNMjEx\nMTI5MDcwMDU0WhcNMzExMTI3MDcwMDU0WjA7MRwwGgYDVQQKExNkeW5hbWljbGlz\ndGVuZXItb3JnMRswGQYDVQQDExJkeW5hbWljbGlzdGVuZXItY2EwWTATBgcqhkjO\nPQIBBggqhkjOPQMBBwNCAARppCv2i2N7k6tF4DWBaJAHhOdwC1SMfymJaj8LUwOP\nfGsMhpLVlI/6Go7FIRPAIkGxoPqc0CeayxrcGun0R66Ao0IwQDAOBgNVHQ8BAf8E\nBAMCAqQwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUPUA/ljB4n8GEH5Tgok0c\n4Wk98+QwCgYIKoZIzj0EAwIDSAAwRQIhAJn4aRTOGsJCaQllCXzDw/vl3o3AmY0a\nqTSMjPRo91vMAiBTnYJMP92NZUoqVV6tG8H+PdsTK/QeTSHm1m4iju1JBg==\n-----END CERTIFICATE-----", "kubeCredentials": null, "kubeConfigs": null } }, "CurrentServer": "rancherDefault" }
[root@localhost ~]# rancher clusters CURRENT ID STATE NAME PROVIDER NODES CPU RAM PODS * local active local Unknown 1 0.10/4 0.07/7.51 GB 5/110
[root@localhost ~]# rancher nodes ID NAME STATE POOL DESCRIPTION local:machine-5p4pj local-node active
[root@localhost ~]# rancher catalog ID NAME URL BRANCH KIND helm helm https://kubernetes-charts.storage.googleapis.com/ master helm library library https://git.rancher.io/charts master helm
[root@localhost ~]# rancher settings ID NAME VALUE agent-image agent-image rancher/rancher-agent:v2.1.6 api-ui-version api-ui-version 1.1.6 cacerts cacerts -----BEGIN CERTIFICATE----- MIIC7jCCAdagAwIBAgIBADANBgkqhkiG9w0BAQsFADAoMRIwEAYDVQQKEwl0aGUt cmFuY2gxEjAQBgNVBAMTCWNhdHRsZS1jYTAeFw0xOTAzMTkwODUxNTNaFw0yOTAz MTYwODUxNTNaMCgxEjAQBgNVBAoTCXRoZS1yYW5jaDESMBAGA1UEAxMJY2F0dGxl LWNhMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2j/x0F+VpdPHv6ce zKYAcGeGDjHfv8YL4Q6NpO4m6N3z3WwC9e9qNq062TGWml3q3xIu0ll229vTXYZG YaW7hdIYdNcgE4d2DSFiM0rV2CCiBheAidcvGWTmVuRqDaH7+ofxUeuz940osjcY GKYkugUnPA9n6cXRF8KF9a6d6t2Kcwqyd3A5c5ld+lPsu2u6lbJhJArdGWmi8Iiq CpkgmPyabCJhpF/YRtLfZ6+mQ0SpcapAuVvXiSGyHjnXykxywthSnTHgSJp48SV7 XCYJx5skU4rqKOWRgwfgQLWnLdV6kWLTH7EE+aiBwt2lygZUR3Ekpr3rXe7Q+dHh ygOYVwIDAQABoyMwITAOBgNVHQ8BAf8EBAMCAqQwDwYDVR0TAQH/BAUwAwEB/zAN BgkqhkiG9w0BAQsFAAOCAQEAMfDWlobAEGKvhLW380JA93IcafbQGgTLyhBglqwF B4SBj56ZTki2mZrccUZXYKzIPTRwY39cnBakjkkczm4Hkci3Ag+4hz9g5mJWAa/H mYrxNEdUJNiih7RNwBne0MaLSHH1MjBfmCSExCJkqlXuD4XXY7dJ05ZQ6urWB2ZI lC7oqwGUxnvDSEMONHLTNQy+5yA+jSae9holJ5kpvEq6vE9A1PoUg4/leHZXsI5L h+gDJX+WbAn5rdyDB0F4XJxn/glQPGxFNib8EUGt4b58re4x9A8ZaVbzL+KEKrS1 7QO13jU95Cy5+FA5GKO3YILrkvCFIoEaRe83jlbiQZSSaw== -----END CERTIFICATE----- cli-url-darwin cli-url-darwin https://releases.rancher.com/cli2/v2.0.6/rancher-darwin-amd64-v2.0.6.tar.gz cli-url-linux cli-url-linux https://releases.rancher.com/cli2/v2.0.6/rancher-linux-amd64-v2.0.6.tar.gz cli-url-windows cli-url-windows https://releases.rancher.com/cli2/v2.0.6/rancher-windows-386-v2.0.6.zip engine-install-url engine-install-url https://releases.rancher.com/install-docker/17.03.sh engine-iso-url engine-iso-url https://releases.rancher.com/os/latest/rancheros-vmware.iso engine-newest-version engine-newest-version v17.12.0 engine-supported-range engine-supported-range ~v1.11.2 || ~v1.12.0 || ~v1.13.0 || ~v17.03.0 first-login first-login false helm-version helm-version v2.10.0-rancher5 ingress-ip-domain ingress-ip-domain xip.io install-uuid install-uuid 6002fd6a-f4ae-454b-a17b-f90c64aafa2a k8s-version k8s-version v1.11.6-rancher1-1 k8s-version-to-images k8s-version-to-images {"v1.10.12-rancher1-1":null,"v1.11.6-rancher1-1":null,"v1.12.4-rancher1-1":null,"v1.9.7-rancher2-2":null} machine-version machine-version v0.15.0-rancher1-1 namespace namespace peer-service peer-service rdns-base-url rdns-base-url https://api.lb.rancher.cloud/v1 rke-version rke-version v0.1.15 server-image server-image rancher/rancher server-url server-url https://192.168.0.157 server-version server-version v2.1.6 system-default-registry system-default-registry system-namespaces system-namespaces kube-system,kube-public,cattle-system,cattle-alerting,cattle-logging,cattle-pipeline,ingress-nginx telemetry-opt telemetry-opt in telemetry-uid telemetry-uid bf1dd7d1-e0ed-475e-9dfe-e9af2d71f9b3 ui-feedback-form ui-feedback-form ui-index ui-index https://releases.rancher.com/ui/latest2/index.html ui-path ui-path /usr/share/rancher/ui ui-pl ui-pl rancher whitelist-domain whitelist-domain forums.rancher.com windows-agent-image windows-agent-image rancher/rancher-agent:v2.1.6-nanoserver-1803
[root@localhost ~]# rancher kubectl get pods --all-namespaces NAMESPACE NAME READY STATUS RESTARTS AGE cattle-fleet-local-system fleet-agent-59b74595c-xgnjg 1/1 Running 5 129m cattle-fleet-system fleet-controller-66cc4c6b5b-xswdl 1/1 Running 5 131m cattle-fleet-system gitjob-5778966b7c-jqdtj 1/1 Running 5 131m cattle-system rancher-webhook-6979fbd4bf-gs8vk 1/1 Running 5 129m kube-system coredns-7448499f4d-4n2vt 1/1 Running 5 134m