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
c77d95bc
Commit
c77d95bc
authored
Dec 10, 2015
by
Filip Grzadkowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address remaining comments from #18425
parent
bd7cd740
Show 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 @
c77d95bc
#!/bin/bash
#!/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");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -30,9 +30,9 @@ set -o pipefail
...
@@ -30,9 +30,9 @@ set -o pipefail
KUBE_HOST
=
${
KUBE_HOST
:-
localhost
}
KUBE_HOST
=
${
KUBE_HOST
:-
localhost
}
RED
=
"
\0
33[0;31m"
declare
-r
RED
=
"
\0
33[0;31m"
GREEN
=
"
\0
33[0;32m"
declare
-r
GREEN
=
"
\0
33[0;32m"
ORANGE
=
"
\0
33[0;33m"
declare
-r
YELLOW
=
"
\0
33[0;33m"
function
echo_green
{
function
echo_green
{
echo
-e
"
${
GREEN
}
$1
"
;
tput sgr0
echo
-e
"
${
GREEN
}
$1
"
;
tput sgr0
...
@@ -42,12 +42,12 @@ function echo_red {
...
@@ -42,12 +42,12 @@ function echo_red {
echo
-e
"
${
RED
}
$1
"
;
tput sgr0
echo
-e
"
${
RED
}
$1
"
;
tput sgr0
}
}
function
echo_
orange
{
function
echo_
yellow
{
echo
-e
"
${
ORANGE
}
$1
"
;
tput sgr0
echo
-e
"
${
YELLOW
}
$1
"
;
tput sgr0
}
}
function
run
{
function
run
{
output
=
`
$1
2>&1
||
true
`
output
=
$(
$1
2>&1
||
true
)
if
[
$?
-eq
0
]
;
then
if
[
$?
-eq
0
]
;
then
echo_green
"SUCCESS"
echo_green
"SUCCESS"
else
else
...
@@ -83,7 +83,7 @@ function create_cluster {
...
@@ -83,7 +83,7 @@ function create_cluster {
echo
-e
-n
"
\t
Waiting for master components to start..."
echo
-e
-n
"
\t
Waiting for master components to start..."
while
true
;
do
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.
# We expect to have 3 running pods - etcd, master and kube-proxy.
if
[
"
$running_count
"
-ge
3
]
;
then
if
[
"
$running_count
"
-ge
3
]
;
then
break
break
...
@@ -139,9 +139,9 @@ else
...
@@ -139,9 +139,9 @@ else
exit
3
exit
3
fi
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..."
echo
-n
"Downloading kubectl binary..."
if
[[
$(
which wget
)
]]
;
then
if
[[
$(
which wget
)
]]
;
then
run
"wget
${
kubectl_url
}
"
run
"wget
${
kubectl_url
}
"
...
@@ -154,6 +154,8 @@ if [[ `ls . | grep ^kubectl$ | wc -l` -lt 1 ]]; then
...
@@ -154,6 +154,8 @@ if [[ `ls . | grep ^kubectl$ | wc -l` -lt 1 ]]; then
chmod
a+x kubectl
chmod
a+x kubectl
echo
""
echo
""
else
else
# TODO: We should detect version of kubectl binary if it too old
# download newer version.
echo
"Detected existing kubectl binary. Skipping download."
echo
"Detected existing kubectl binary. Skipping download."
fi
fi
...
@@ -162,7 +164,7 @@ create_cluster
...
@@ -162,7 +164,7 @@ create_cluster
echo
""
echo
""
echo
""
echo
""
echo
"To list the nodes in your cluster run"
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
""
echo
"To run your first pod run"
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