Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
1b70a403
Commit
1b70a403
authored
Dec 10, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #18512 from fgrzadkowski/local_script
Auto commit by PR queue bot
parents
fda0f913
c77d95bc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
12 deletions
+14
-12
get-kube-local.sh
cluster/get-kube-local.sh
+14
-12
No files found.
cluster/get-kube-local.sh
View file @
1b70a403
#!/bin/bash
# Copyright 201
4
The Kubernetes Authors All rights reserved.
# Copyright 201
5
The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -30,9 +30,9 @@ set -o pipefail
KUBE_HOST
=
${
KUBE_HOST
:-
localhost
}
RED
=
"
\0
33[0;31m"
GREEN
=
"
\0
33[0;32m"
ORANGE
=
"
\0
33[0;33m"
declare
-r
RED
=
"
\0
33[0;31m"
declare
-r
GREEN
=
"
\0
33[0;32m"
declare
-r
YELLOW
=
"
\0
33[0;33m"
function
echo_green
{
echo
-e
"
${
GREEN
}
$1
"
;
tput sgr0
...
...
@@ -42,12 +42,12 @@ function echo_red {
echo
-e
"
${
RED
}
$1
"
;
tput sgr0
}
function
echo_
orange
{
echo
-e
"
${
ORANGE
}
$1
"
;
tput sgr0
function
echo_
yellow
{
echo
-e
"
${
YELLOW
}
$1
"
;
tput sgr0
}
function
run
{
output
=
`
$1
2>&1
||
true
`
output
=
$(
$1
2>&1
||
true
)
if
[
$?
-eq
0
]
;
then
echo_green
"SUCCESS"
else
...
...
@@ -83,7 +83,7 @@ function create_cluster {
echo
-e
-n
"
\t
Waiting for master components to start..."
while
true
;
do
local
running_count
=
`
kubectl
-s
=
http://
${
KUBE_HOST
}
:8080 get pods
--no-headers
2>/dev/null |
grep
"Running"
|
wc
-l
`
local
running_count
=
$(
kubectl
-s
=
http://
${
KUBE_HOST
}
:8080 get pods
--no-headers
2>/dev/null |
grep
"Running"
|
wc
-l
)
# We expect to have 3 running pods - etcd, master and kube-proxy.
if
[
"
$running_count
"
-ge
3
]
;
then
break
...
...
@@ -139,9 +139,9 @@ else
exit
3
fi
kubectl_url
=
https://storage.googleapis.com/kubernetes-release/release/
${
release
}
/bin/
${
platform
}
/
${
arch
}
/kubectl
kubectl_url
=
"https://storage.googleapis.com/kubernetes-release/release/
${
release
}
/bin/
${
platform
}
/
${
arch
}
/kubectl"
if
[[
`
ls
.
|
grep
^kubectl
$
|
wc
-l
`
-lt
1
]]
;
then
if
[[
$(
ls
.
|
grep
^kubectl
$
|
wc
-l
)
-lt
1
]]
;
then
echo
-n
"Downloading kubectl binary..."
if
[[
$(
which wget
)
]]
;
then
run
"wget
${
kubectl_url
}
"
...
...
@@ -154,6 +154,8 @@ if [[ `ls . | grep ^kubectl$ | wc -l` -lt 1 ]]; then
chmod
a+x kubectl
echo
""
else
# TODO: We should detect version of kubectl binary if it too old
# download newer version.
echo
"Detected existing kubectl binary. Skipping download."
fi
...
...
@@ -162,7 +164,7 @@ create_cluster
echo
""
echo
""
echo
"To list the nodes in your cluster run"
echo_
orange
"
\t
kubectl -s=http://
${
KUBE_HOST
}
:8080 get nodes"
echo_
yellow
"
\t
kubectl -s=http://
${
KUBE_HOST
}
:8080 get nodes"
echo
""
echo
"To run your first pod run"
echo_
orange
"
\t
kubectl -s http://
${
KUBE_HOST
}
:8080 run nginx --image=nginx --port=80"
echo_
yellow
"
\t
kubectl -s http://
${
KUBE_HOST
}
:8080 run nginx --image=nginx --port=80"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment