text stringlengths 0 59.1k |
|---|
- image: radial/busyboxplus:curl |
command: |
- sleep |
- "360000000" |
imagePullPolicy: IfNotPresent |
name: curlcontainer |
restartPolicy: Always |
``` |
And test that you can actually reach the test nginx service across continents |
``` |
$ kubectl config use-context <clustername_us> |
$ kubectl -it exec curlpod -- /bin/sh |
[ root@curlpod:/ ]$ curl http://10.244.0.4:80 |
Europe nginx |
``` |
## Granting access to the remote cluster |
We will grant the US cluster access to the Europe cluster. Basically we're going to setup a secret that allows kubectl to function in a pod running in the US cluster, just like it did on our local machine in the previous step. First create a secret with the contents of the current .kube/config: |
```shell |
$ kubectl config use-context <clustername_eu> |
$ go run ./make_secret.go --kubeconfig=$HOME/.kube/config > /tmp/secret.json |
$ kubectl config use-context <clustername_us> |
$ kubectl create -f /tmp/secret.json |
``` |
Create a kubectl pod that uses the secret, in the US cluster. |
```json |
{ |
"kind": "Pod", |
"apiVersion": "v1", |
"metadata": { |
"name": "kubectl-tester" |
}, |
"spec": { |
"volumes": [ |
{ |
"name": "secret-volume", |
"secret": { |
"secretName": "kubeconfig" |
} |
} |
], |
"containers": [ |
{ |
"name": "kubectl", |
"image": "bprashanth/kubectl:0.0", |
"imagePullPolicy": "Always", |
"env": [ |
{ |
"name": "KUBECONFIG", |
"value": "/.kube/config" |
} |
], |
"args": [ |
"proxy", "-p", "8001" |
], |
"volumeMounts": [ |
{ |
"name": "secret-volume", |
"mountPath": "/.kube" |
} |
] |
} |
] |
} |
} |
``` |
And check that you can access the remote cluster |
```shell |
$ kubectl config use-context <clustername_us> |
$ kubectl exec -it kubectl-tester bash |
kubectl-tester $ kubectl get nodes |
NAME LABELS STATUS |
eu-node-0n61 kubernetes.io/hostname=eu-node-0n61 Ready |
eu-node-79ua kubernetes.io/hostname=eu-node-79ua Ready |
eu-node-7wz7 kubernetes.io/hostname=eu-node-7wz7 Ready |
eu-node-loh2 kubernetes.io/hostname=eu-node-loh2 Ready |
``` |
For a more advanced example of sharing clusters, see the [service-loadbalancer](https://github.com/kubernetes/contrib/tree/master/service-loadbalancer/README.md) |
<|endoftext|> |
# source: k8s_examples/_archived/javaweb-tomcat-sidecar/javaweb.yaml type: yaml |
apiVersion: v1 |
kind: Pod |
metadata: |
name: javaweb |
spec: |
initContainers: |
- image: resouer/sample:v1 |
name: war |
command: ["cp", "/sample.war", "/app"] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.