mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-08 12:41:58 +00:00
Purge cluster/kubectl.sh from nearly all docs.
Mark cluster/kubectl.sh as deprecated.
This commit is contained in:
@@ -16,14 +16,14 @@ $ hack/dev-build-and-up.sh
|
||||
We'll see how cluster DNS works across multiple [namespaces](../../docs/namespaces.md), first we need to create two namespaces:
|
||||
|
||||
```shell
|
||||
$ cluster/kubectl.sh create -f examples/cluster-dns/namespace-dev.yaml
|
||||
$ cluster/kubectl.sh create -f examples/cluster-dns/namespace-prod.yaml
|
||||
$ kubectl create -f examples/cluster-dns/namespace-dev.yaml
|
||||
$ kubectl create -f examples/cluster-dns/namespace-prod.yaml
|
||||
```
|
||||
|
||||
Now list all namespaces:
|
||||
|
||||
```shell
|
||||
$ cluster/kubectl.sh get namespaces
|
||||
$ kubectl get namespaces
|
||||
NAME LABELS STATUS
|
||||
default <none> Active
|
||||
development name=development Active
|
||||
@@ -33,8 +33,8 @@ production name=production Active
|
||||
For kubectl client to work with each namespace, we define two contexts:
|
||||
|
||||
```shell
|
||||
$ cluster/kubectl.sh config set-context dev --namespace=development --cluster=${CLUSTER_NAME} --user=${USER_NAME}
|
||||
$ cluster/kubectl.sh config set-context prod --namespace=production --cluster=${CLUSTER_NAME} --user=${USER_NAME}
|
||||
$ kubectl config set-context dev --namespace=development --cluster=${CLUSTER_NAME} --user=${USER_NAME}
|
||||
$ kubectl config set-context prod --namespace=production --cluster=${CLUSTER_NAME} --user=${USER_NAME}
|
||||
```
|
||||
|
||||
### Step Two: Create backend replication controller in each namespace
|
||||
@@ -42,14 +42,14 @@ $ cluster/kubectl.sh config set-context prod --namespace=production --cluster=${
|
||||
Use the file [`examples/cluster-dns/dns-backend-rc.yaml`](dns-backend-rc.yaml) to create a backend server [replication controller](../../docs/replication-controller.md) in each namespace.
|
||||
|
||||
```shell
|
||||
$ cluster/kubectl.sh config use-context dev
|
||||
$ cluster/kubectl.sh create -f examples/cluster-dns/dns-backend-rc.yaml
|
||||
$ kubectl config use-context dev
|
||||
$ kubectl create -f examples/cluster-dns/dns-backend-rc.yaml
|
||||
```
|
||||
|
||||
Once that's up you can list the pod in the cluster:
|
||||
|
||||
```shell
|
||||
$ cluster/kubectl.sh get rc
|
||||
$ kubectl get rc
|
||||
CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS
|
||||
dns-backend dns-backend ddysher/dns-backend name=dns-backend 1
|
||||
```
|
||||
@@ -57,9 +57,9 @@ dns-backend dns-backend ddysher/dns-backend name=dns-backend 1
|
||||
Now repeat the above commands to create a replication controller in prod namespace:
|
||||
|
||||
```shell
|
||||
$ cluster/kubectl.sh config use-context prod
|
||||
$ cluster/kubectl.sh create -f examples/cluster-dns/dns-backend-rc.yaml
|
||||
$ cluster/kubectl.sh get rc
|
||||
$ kubectl config use-context prod
|
||||
$ kubectl create -f examples/cluster-dns/dns-backend-rc.yaml
|
||||
$ kubectl get rc
|
||||
CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS
|
||||
dns-backend dns-backend ddysher/dns-backend name=dns-backend 1
|
||||
```
|
||||
@@ -70,14 +70,14 @@ Use the file [`examples/cluster-dns/dns-backend-service.yaml`](dns-backend-servi
|
||||
a [service](../../docs/services.md) for the backend server.
|
||||
|
||||
```shell
|
||||
$ cluster/kubectl.sh config use-context dev
|
||||
$ cluster/kubectl.sh create -f examples/cluster-dns/dns-backend-service.yaml
|
||||
$ kubectl config use-context dev
|
||||
$ kubectl create -f examples/cluster-dns/dns-backend-service.yaml
|
||||
```
|
||||
|
||||
Once that's up you can list the service in the cluster:
|
||||
|
||||
```shell
|
||||
$ cluster/kubectl.sh get service dns-backend
|
||||
$ kubectl get service dns-backend
|
||||
NAME LABELS SELECTOR IP(S) PORT(S)
|
||||
dns-backend <none> name=dns-backend 10.0.236.129 8000/TCP
|
||||
```
|
||||
@@ -85,9 +85,9 @@ dns-backend <none> name=dns-backend 10.0.236.129 8000/TCP
|
||||
Again, repeat the same process for prod namespace:
|
||||
|
||||
```shell
|
||||
$ cluster/kubectl.sh config use-context prod
|
||||
$ cluster/kubectl.sh create -f examples/cluster-dns/dns-backend-service.yaml
|
||||
$ cluster/kubectl.sh get service dns-backend
|
||||
$ kubectl config use-context prod
|
||||
$ kubectl create -f examples/cluster-dns/dns-backend-service.yaml
|
||||
$ kubectl get service dns-backend
|
||||
NAME LABELS SELECTOR IP(S) PORT(S)
|
||||
dns-backend <none> name=dns-backend 10.0.35.246 8000/TCP
|
||||
```
|
||||
@@ -97,14 +97,14 @@ dns-backend <none> name=dns-backend 10.0.35.246 8000/TCP
|
||||
Use the file [`examples/cluster-dns/dns-frontend-pod.yaml`](dns-frontend-pod.yaml) to create a client [pod](../../docs/pods.md) in dev namespace. The client pod will make a connection to backend and exit. Specifically, it tries to connect to address `http://dns-backend.development.kubernetes.local:8000`.
|
||||
|
||||
```shell
|
||||
$ cluster/kubectl.sh config use-context dev
|
||||
$ cluster/kubectl.sh create -f examples/cluster-dns/dns-frontend-pod.yaml
|
||||
$ kubectl config use-context dev
|
||||
$ kubectl create -f examples/cluster-dns/dns-frontend-pod.yaml
|
||||
```
|
||||
|
||||
Once that's up you can list the pod in the cluster:
|
||||
|
||||
```shell
|
||||
$ cluster/kubectl.sh get pods dns-frontend
|
||||
$ kubectl get pods dns-frontend
|
||||
POD IP CONTAINER(S) IMAGE(S) HOST LABELS STATUS CREATED MESSAGE
|
||||
dns-frontend 10.244.2.9 kubernetes-minion-sswf/104.154.55.211 name=dns-frontend Running 3 seconds
|
||||
dns-frontend ddysher/dns-frontend Running 2 seconds
|
||||
@@ -113,7 +113,7 @@ dns-frontend 10.244.2.9 kubernetes-min
|
||||
Wait until the pod succeeds, then we can see the output from the client pod:
|
||||
|
||||
```shell
|
||||
$ cluster/kubectl.sh log dns-frontend
|
||||
$ kubectl log dns-frontend
|
||||
2015-05-07T20:13:54.147664936Z 10.0.236.129
|
||||
2015-05-07T20:13:54.147721290Z Send request to: http://dns-backend.development.kubernetes.local:8000
|
||||
2015-05-07T20:13:54.147733438Z <Response [200]>
|
||||
@@ -123,9 +123,9 @@ $ cluster/kubectl.sh log dns-frontend
|
||||
Please refer to the [source code](./images/frontend/client.py) about the logs. First line prints out the ip address associated with the service in dev namespace; remaining lines print out our request and server response. If we switch to prod namespace with the same pod config, we'll see the same result, i.e. dns will resolve across namespace.
|
||||
|
||||
```shell
|
||||
$ cluster/kubectl.sh config use-context prod
|
||||
$ cluster/kubectl.sh create -f examples/cluster-dns/dns-frontend-pod.yaml
|
||||
$ cluster/kubectl.sh log dns-frontend
|
||||
$ kubectl config use-context prod
|
||||
$ kubectl create -f examples/cluster-dns/dns-frontend-pod.yaml
|
||||
$ kubectl log dns-frontend
|
||||
2015-05-07T20:13:54.147664936Z 10.0.236.129
|
||||
2015-05-07T20:13:54.147721290Z Send request to: http://dns-backend.development.kubernetes.local:8000
|
||||
2015-05-07T20:13:54.147733438Z <Response [200]>
|
||||
|
Reference in New Issue
Block a user