[root@utility ~]# export KUBECONFIG=/home/lab/ocp4/auth/kubeconfig [root@utility ~]# oc get nodes NAME STATUS ROLES AGE VERSION master01 Ready control-plane,master,worker 447d v1.25.4+77bec7a
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
[root@utility ~]# oc login -u kubeadmin -p 8UgkW-u7pMu-223kK-PmNZH https://api.ocp4.example.com:6443 The server uses a certificate signed by an unknown authority. You can bypass the certificate check, but any data you send to the server could be intercepted by others. Use insecure connections? (y/n): y
WARNING: Using insecure TLS client config. Setting this option is not supported!
Login successful.
You have access to 72 projects, the list has been suppressed. You can list all projects with 'oc projects'
Using project "default". Welcome! See 'oc help' to get started.
[root@utility ~]# oc get nodes NAME STATUS ROLES AGE VERSION master01 Ready control-plane,master,worker 447d v1.25.4+77bec7a
[student@workstation ~]$ htpasswd --help -c Create a new file. -b Use the password from the command line rather than prompting for it. -B Force bcrypt encryption of the password (very secure).
这里创建了一个new-htpasswd.txt的文件,里面包含两个用户
1 2 3 4 5 6 7
[student@workstation ~]$ htpasswd -c -B -b new-htpasswd.txt lxh-admin lxhpass Adding password for user lxh-admin [student@workstation ~]$ htpasswd -B -b new-htpasswd.txt zhangsan zhangsanpass Adding password for user zhangsan [student@workstation ~]$ cat new-htpasswd.txt lxh-admin:$2y$05$hGcuccbY8BGrmq5G58f3zOP2hz2w1/WqNPepJZ1oXsL9pUHoPOKzK zhangsan:$2y$05$JFwYSQdeZmU1p1vv8vKweO9g2pApGcH8E7UHC7PwH5eZ6joLG4aua
[student@workstation ~]$ oc get co NAME VERSION AVAILABLE PROGRESSING DEGRADED SINCE MESSAGE authentication 4.12.0 True True False 2s OAuthServerDeploymentProgressing: deployment/oauth-openshift.openshift-authentication: observed generation is 13, desired generation is 14.
You have access to 72 projects, the list has been suppressed. You can list all projects with 'oc projects'
Using project "default". [student@workstation ~]$ oc get nodes NAME STATUS ROLES AGE VERSION master01 Ready control-plane,master,worker 447d v1.25.4+77bec7a
[student@workstation ~]$ oc get users NAME UID FULL NAME IDENTITIES admin bc98d46a-dd9f-4917-8246-089f10f95e75 Administrator Red Hat Identity Management:dWlkPWFkbWluLGNuPXVzZXJzLGNuPWFjY291bnRzLGRjPW9jcDQsZGM9ZXhhbXBsZSxkYz1jb20 developer 12724778-65ba-411a-aa80-a9634228e116 . developer Red Hat Identity Management:dWlkPWRldmVsb3Blcixjbj11c2Vycyxjbj1hY2NvdW50cyxkYz1vY3A0LGRjPWV4YW1wbGUsZGM9Y29t lxh-admin 693dfbd1-5721-4ffe-b569-fa346675cf61 Lxh-Users:lxh-admin zhangsan 6563b503-367e-47fe-8a40-62dcb37e344a Lxh-Users:zhangsan [student@workstation ~]$ oc get identities.user.openshift.io NAME IDP NAME IDP USER NAME USER NAME USER UID Lxh-Users:lxh-admin Lxh-Users lxh-admin lxh-admin 693dfbd1-5721-4ffe-b569-fa346675cf61
You don't have any projects. You can try to create a new project, by running oc new-project <projectname> [student@workstation ~]$ oc get nodes Error from server (Forbidden): nodes is forbidden: User "zhangsan" cannot list resource "nodes" in API group "" at the cluster scope [student@workstation ~]$ oc get nodes Error from server (Forbidden): nodes is forbidden: User "zhangsan" cannot list resource "nodes" in API group "" at the cluster scope [student@workstation ~]$ oc get users Error from server (Forbidden): users.user.openshift.io is forbidden: User "zhangsan" cannot list resource "users" in API group "user.openshift.io" at the cluster scope [student@workstation ~]$ oc get identities.user.openshift.io Error from server (Forbidden): identities.user.openshift.io is forbidden: User "zhangsan" cannot list resource "identities" in API group "user.openshift.io" at the clu