You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/docs/user-journeys/users/application-developer/tryitout.md
+50-6Lines changed: 50 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,19 +43,63 @@ For the purposes of this tutorial, we have installed and preconfigured Minikube
43
43
kubectl version
44
44
```
45
45
46
-
47
-
48
-
49
46
{{% /tab %}}
50
47
{{% tab name="2. Deploy" %}}
51
48
52
-
1. Verify the deployment.
49
+
1. View the cluster details
53
50
54
51
```
55
-
kubectl get deployments
52
+
kubectl cluster-info
56
53
```
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:
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.
0 commit comments