Skip to content

Commit 1ec72d2

Browse files
committed
Update info on authentication. Remove step for disabling anonymous auth
1 parent c44f7df commit 1ec72d2

File tree

1 file changed

+9
-43
lines changed

1 file changed

+9
-43
lines changed

manual-remote-access.md

Lines changed: 9 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -70,44 +70,7 @@ host: Running
7070
kubelet: Running
7171
```
7272

73-
5. Disable anonymous API access
74-
75-
```shell
76-
ubuntu@kubectl-ghactions-test:~$ minikube ssh
77-
docker@minikube:~$ sudo vi /etc/kubernetes/manifests/kube-apiserver.yaml
78-
```
79-
80-
- Add `--anonymous-auth=false` under `command`
81-
- Save and exit, minikube will automatically restart the API server, you may have to wait a few seconds
82-
83-
- See that anonymous requests are blocked
84-
85-
```shell
86-
ubuntu@kubectl-ghactions-test:~$ curl -k https://$(minikube ip):8443/api/v1/namespaces/default/pods
87-
{
88-
"kind": "Status",
89-
"apiVersion": "v1",
90-
"metadata": {},
91-
"status": "Failure",
92-
"message": "Unauthorized",
93-
"reason": "Unauthorized",
94-
"code": 401
95-
}
96-
97-
ubuntu@kubectl-ghactions-test:~$ curl --cert /home/ubuntu/.minikube/profiles/minikube/client.crt \
98-
--key /home/ubuntu/.minikube/profiles/minikube/client.key \
99-
-k https://$(minikube ip):8443/api/v1/namespaces/default/pods
100-
{
101-
"kind": "PodList",
102-
"apiVersion": "v1",
103-
"metadata": {
104-
"resourceVersion": "1080"
105-
},
106-
"items": []
107-
}
108-
```
109-
110-
7. Run the kube-API proxy on the server
73+
5. Run the kube-API proxy on the server
11174

11275
- We're going to use an apache2 webserver to proxy requests to the server to the minikube kube-API
11376

@@ -152,7 +115,7 @@ ubuntu@kubectl-ghactions-test:~$ curl --cert /home/ubuntu/.minikube/profiles/min
152115
ubuntu@kubectl-ghactions-test:~$ sudo a2ensite kubectl
153116
```
154117

155-
8. Check if the API is accessible remotely
118+
6. Check if the API is accessible remotely
156119

157120
```shell
158121
$ curl -X GET <your-server-url>/api
@@ -161,19 +124,22 @@ $ curl -X GET <your-server-url>/api
161124
"apiVersion": "v1",
162125
"metadata": {},
163126
"status": "Failure",
164-
"message": "Unauthorized",
165-
"reason": "Unauthorized",
166-
"code": 401
127+
"message": "forbidden: User \"system:anonymous\" cannot get path \"/api/\"",
128+
"reason": "Forbidden",
129+
"details": {},
130+
"code": 403
167131
}
168132
```
169133

170-
9. Authorize with the API
134+
7. Authorize with the API
171135

172136
- See [Using RBAC Authorization | Kubernetes](https://kubernetes.io/docs/reference/access-authn-authz/rbac/)
173137

174138
- On the minikube host:
175139
1. Create a service account, `ClusterRoleBinding`, and token
176140

141+
- We create a service account called remote-dev that we will authenticate as
142+
- We then create a `ClusterRoleBinding` referencing the `cluster-admin` role (created by default which provides full access to everything in the cluster) and bind the remote-dev account we just created to it
177143
```shell
178144
ubuntu@kubectl-ghactions-test:~$ kubectl create serviceaccount remote-dev
179145
ubuntu@kubectl-ghactions-test:~$ kubectl create clusterrolebinding remote-dev-binding \

0 commit comments

Comments
 (0)