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
c0bfc5d8
Unverified
Commit
c0bfc5d8
authored
Mar 20, 2019
by
Darren Shepherd
Committed by
GitHub
Mar 20, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into docker-fix
parents
f0077e2f
697c6e15
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
14 deletions
+26
-14
README.md
README.md
+4
-4
controller.go
pkg/deploy/controller.go
+20
-5
controller.go
pkg/servicelb/controller.go
+2
-5
No files found.
README.md
View file @
c0bfc5d8
...
@@ -163,14 +163,14 @@ Open ports / Network security
...
@@ -163,14 +163,14 @@ Open ports / Network security
---------------------------
---------------------------
The server needs port 6443 to be accessible by the nodes. The nodes need to be able to reach
The server needs port 6443 to be accessible by the nodes. The nodes need to be able to reach
other nodes over UDP port
4789
. This is used for flannel VXLAN. If you don't use flannel
other nodes over UDP port
8472
. This is used for flannel VXLAN. If you don't use flannel
and provide your own custom CNI, then
4789
is not needed by k3s. The node should not listen
and provide your own custom CNI, then
8472
is not needed by k3s. The node should not listen
on any other port. k3s uses reverse tunneling such that the nodes make outbound connections
on any other port. k3s uses reverse tunneling such that the nodes make outbound connections
to the server and all kubelet traffic runs through that tunnel.
to the server and all kubelet traffic runs through that tunnel.
IMPORTANT. The VXLAN port on nodes should not be exposed to the world, it opens up your
IMPORTANT. The VXLAN port on nodes should not be exposed to the world, it opens up your
cluster network to accessed by anyone. Run your nodes behind a firewall/security group that
cluster network to accessed by anyone. Run your nodes behind a firewall/security group that
disables access to port
4789
.
disables access to port
8472
.
Server HA
Server HA
...
@@ -217,7 +217,7 @@ k3s includes and defaults to containerd. Why? Because it's just plain better. If
...
@@ -217,7 +217,7 @@ k3s includes and defaults to containerd. Why? Because it's just plain better. If
run with Docker first stop and think, "Really? Do I really want more headache?" If still
run with Docker first stop and think, "Really? Do I really want more headache?" If still
yes then you just need to run the agent with the
`--docker`
flag
yes then you just need to run the agent with the
`--docker`
flag
k3s agent -
u
${SERVER_URL} -t ${NODE_TOKEN} --docker &
k3s agent -
s
${SERVER_URL} -t ${NODE_TOKEN} --docker &
systemd
systemd
-------
-------
...
...
pkg/deploy/controller.go
View file @
c0bfc5d8
...
@@ -251,6 +251,18 @@ func checksum(bytes []byte) string {
...
@@ -251,6 +251,18 @@ func checksum(bytes []byte) string {
return
hex
.
EncodeToString
(
d
[
:
])
return
hex
.
EncodeToString
(
d
[
:
])
}
}
func
isEmptyYaml
(
yaml
[]
byte
)
bool
{
isEmpty
:=
true
lines
:=
bytes
.
Split
(
yaml
,
[]
byte
(
"
\n
"
))
for
_
,
l
:=
range
lines
{
s
:=
bytes
.
TrimSpace
(
l
)
if
string
(
s
)
!=
"---"
&&
!
bytes
.
HasPrefix
(
s
,
[]
byte
(
"#"
))
&&
string
(
s
)
!=
""
{
isEmpty
=
false
}
}
return
isEmpty
}
func
yamlToObjects
(
in
io
.
Reader
)
([]
runtime
.
Object
,
error
)
{
func
yamlToObjects
(
in
io
.
Reader
)
([]
runtime
.
Object
,
error
)
{
var
result
[]
runtime
.
Object
var
result
[]
runtime
.
Object
reader
:=
yamlDecoder
.
NewYAMLReader
(
bufio
.
NewReaderSize
(
in
,
4096
))
reader
:=
yamlDecoder
.
NewYAMLReader
(
bufio
.
NewReaderSize
(
in
,
4096
))
...
@@ -263,12 +275,14 @@ func yamlToObjects(in io.Reader) ([]runtime.Object, error) {
...
@@ -263,12 +275,14 @@ func yamlToObjects(in io.Reader) ([]runtime.Object, error) {
return
nil
,
err
return
nil
,
err
}
}
obj
,
err
:=
toObjects
(
raw
)
if
!
isEmptyYaml
(
raw
)
{
if
err
!=
nil
{
obj
,
err
:=
toObjects
(
raw
)
return
nil
,
err
if
err
!=
nil
{
}
return
nil
,
err
}
result
=
append
(
result
,
obj
...
)
result
=
append
(
result
,
obj
...
)
}
}
}
return
result
,
nil
return
result
,
nil
...
@@ -279,6 +293,7 @@ func toObjects(bytes []byte) ([]runtime.Object, error) {
...
@@ -279,6 +293,7 @@ func toObjects(bytes []byte) ([]runtime.Object, error) {
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
obj
,
_
,
err
:=
unstructured
.
UnstructuredJSONScheme
.
Decode
(
bytes
,
nil
,
nil
)
obj
,
_
,
err
:=
unstructured
.
UnstructuredJSONScheme
.
Decode
(
bytes
,
nil
,
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
...
pkg/servicelb/controller.go
View file @
c0bfc5d8
...
@@ -272,11 +272,8 @@ func (h *handler) newDeployment(svc *core.Service) (*apps.Deployment, error) {
...
@@ -272,11 +272,8 @@ func (h *handler) newDeployment(svc *core.Service) (*apps.Deployment, error) {
},
},
}
}
for
i
,
port
:=
range
svc
.
Spec
.
Ports
{
for
_
,
port
:=
range
svc
.
Spec
.
Ports
{
portName
:=
port
.
Name
portName
:=
fmt
.
Sprintf
(
"lb-port-%d"
,
port
.
Port
)
if
portName
==
""
{
portName
=
fmt
.
Sprintf
(
"port-%d"
,
i
)
}
container
:=
core
.
Container
{
container
:=
core
.
Container
{
Name
:
portName
,
Name
:
portName
,
Image
:
image
,
Image
:
image
,
...
...
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