Skip to content

Commit ceade6a

Browse files
committed
saved changes
1 parent 3bfea08 commit ceade6a

File tree

1 file changed

+50
-6
lines changed
  • content/en/docs/user-journeys/users/application-developer

1 file changed

+50
-6
lines changed

content/en/docs/user-journeys/users/application-developer/tryitout.md

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,63 @@ For the purposes of this tutorial, we have installed and preconfigured Minikube
4343
kubectl version
4444
```
4545
46-
47-
48-
4946
{{% /tab %}}
5047
{{% tab name="2. Deploy" %}}
5148
52-
1. Verify the deployment.
49+
1. View the cluster details
5350
5451
```
55-
kubectl get deployments
52+
kubectl cluster-info
5653
```
54+
2. View the nodes in the cluster that can be used to host your application:
55+
56+
```
57+
kubectl get nodes
58+
```
59+
60+
3. Run the app on Kubernetes to create a new deployment:
61+
Note:Provide the deployment name, app image location (include the full repository url for images hosted outside Docker hub) and --port parameter so that the app runs on a specific port.
62+
```
63+
kubectl run kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1 --port=8080
64+
```
65+
4. List your deployments :
66+
```
67+
kubectl get deployments
68+
```
69+
5. Pods that are running inside Kubernetes are running on a private, isolated network. By default they are visible from other pods and services within the same kubernetes cluster, but not outside that network. When we use kubectl, we're interacting through an API endpoint to communicate with our application.
70+
71+
We will cover other options on how to expose your application outside the kubernetes cluster in Module 4.
72+
73+
The kubectl command can create a proxy that will forward communications into the cluster-wide, private network. The proxy can be terminated by pressing control-C and won't show any output while its running.
74+
75+
We will open a second terminal window to run the proxy.
76+
77+
kubectl proxy
78+
79+
We now have a connection between our host (the online terminal) and the Kubernetes cluster. The proxy enables direct access to the API from these terminals.
80+
81+
You can see all those APIs hosted through the proxy endpoint, now available at through http://localhost:8001. For example, we can query the version directly through the API using the curl command:
82+
83+
curl http://localhost:8001/version
84+
85+
The API server will automatically create an endpoint for each pod, based on the pod name, that is also accessible through the proxy.
86+
87+
First we need to get the Pod name, and we'll store in the environment variable POD_NAME:
88+
89+
export POD_NAME=$(kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
90+
echo Name of the Pod: $POD_NAME
91+
92+
Now we can make an HTTP request to the application running in that pod:
93+
94+
curl http://localhost:8001/api/v1/namespaces/default/pods/$POD_NAME/proxy/
95+
96+
The url is the route to the API of the Pod.
97+
98+
Note: Check the top of the terminal. The proxy was run in a new tab (Terminal 2), and the recent commands were executed the original tab (Terminal 1). The proxy still runs in the second tab, and this allowed our curl command to work using localhost:8001.
99+
100+
We see that there is 1 deployment running a single instance of your app. The instance is running inside a Docker container on your node.
101+
57102
58-
1. View the app deployment.
59103
60104
```
61105
curl http://localhost:8001/api/v1/namespaces/default/pods/$POD_NAME/proxy/

0 commit comments

Comments
 (0)