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
6a37f450
Unverified
Commit
6a37f450
authored
Jan 23, 2017
by
Lucas Käldström
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add --kubelet-client-{certificate,key} to the apiserver args and make it allowed…
Add --kubelet-client-{certificate,key} to the apiserver args and make it allowed to access the kubelets
parent
6579c945
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
6 deletions
+12
-6
init.go
cmd/kubeadm/app/cmd/init.go
+0
-6
manifests.go
cmd/kubeadm/app/master/manifests.go
+2
-0
manifests_test.go
cmd/kubeadm/app/master/manifests_test.go
+8
-0
certs.go
cmd/kubeadm/app/phases/certs/certs.go
+2
-0
No files found.
cmd/kubeadm/app/cmd/init.go
View file @
6a37f450
...
@@ -168,12 +168,6 @@ func NewInit(cfgPath string, cfg *kubeadmapi.MasterConfiguration, skipPreFlight
...
@@ -168,12 +168,6 @@ func NewInit(cfgPath string, cfg *kubeadmapi.MasterConfiguration, skipPreFlight
// Try to start the kubelet service in case it's inactive
// Try to start the kubelet service in case it's inactive
preflight
.
TryStartKubelet
()
preflight
.
TryStartKubelet
()
// Warn about the limitations with the current cloudprovider solution.
if
cfg
.
CloudProvider
!=
""
{
fmt
.
Println
(
"WARNING: For cloudprovider integrations to work --cloud-provider must be set for all kubelets in the cluster."
)
fmt
.
Println
(
"
\t
(/etc/systemd/system/kubelet.service.d/10-kubeadm.conf should be edited for this purpose)"
)
}
return
&
Init
{
cfg
:
cfg
,
selfHosted
:
selfHosted
},
nil
return
&
Init
{
cfg
:
cfg
,
selfHosted
:
selfHosted
},
nil
}
}
...
...
cmd/kubeadm/app/master/manifests.go
View file @
6a37f450
...
@@ -322,6 +322,8 @@ func getAPIServerCommand(cfg *kubeadmapi.MasterConfiguration, selfHosted bool) [
...
@@ -322,6 +322,8 @@ func getAPIServerCommand(cfg *kubeadmapi.MasterConfiguration, selfHosted bool) [
"--client-ca-file="
+
getCertFilePath
(
kubeadmconstants
.
CACertName
),
"--client-ca-file="
+
getCertFilePath
(
kubeadmconstants
.
CACertName
),
"--tls-cert-file="
+
getCertFilePath
(
kubeadmconstants
.
APIServerCertName
),
"--tls-cert-file="
+
getCertFilePath
(
kubeadmconstants
.
APIServerCertName
),
"--tls-private-key-file="
+
getCertFilePath
(
kubeadmconstants
.
APIServerKeyName
),
"--tls-private-key-file="
+
getCertFilePath
(
kubeadmconstants
.
APIServerKeyName
),
"--kubelet-client-certificate="
+
getCertFilePath
(
kubeadmconstants
.
APIServerCertName
),
"--kubelet-client-key="
+
getCertFilePath
(
kubeadmconstants
.
APIServerKeyName
),
"--token-auth-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/tokens.csv"
,
"--token-auth-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/tokens.csv"
,
fmt
.
Sprintf
(
"--secure-port=%d"
,
cfg
.
API
.
Port
),
fmt
.
Sprintf
(
"--secure-port=%d"
,
cfg
.
API
.
Port
),
"--allow-privileged"
,
"--allow-privileged"
,
...
...
cmd/kubeadm/app/master/manifests_test.go
View file @
6a37f450
...
@@ -376,6 +376,8 @@ func TestGetAPIServerCommand(t *testing.T) {
...
@@ -376,6 +376,8 @@ func TestGetAPIServerCommand(t *testing.T) {
"--client-ca-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/ca.crt"
,
"--client-ca-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/ca.crt"
,
"--tls-cert-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/apiserver.crt"
,
"--tls-cert-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/apiserver.crt"
,
"--tls-private-key-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/apiserver.key"
,
"--tls-private-key-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/apiserver.key"
,
"--kubelet-client-certificate="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/apiserver.crt"
,
"--kubelet-client-key="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/apiserver.key"
,
"--token-auth-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/tokens.csv"
,
"--token-auth-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/tokens.csv"
,
fmt
.
Sprintf
(
"--secure-port=%d"
,
123
),
fmt
.
Sprintf
(
"--secure-port=%d"
,
123
),
"--allow-privileged"
,
"--allow-privileged"
,
...
@@ -397,6 +399,8 @@ func TestGetAPIServerCommand(t *testing.T) {
...
@@ -397,6 +399,8 @@ func TestGetAPIServerCommand(t *testing.T) {
"--client-ca-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/ca.crt"
,
"--client-ca-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/ca.crt"
,
"--tls-cert-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/apiserver.crt"
,
"--tls-cert-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/apiserver.crt"
,
"--tls-private-key-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/apiserver.key"
,
"--tls-private-key-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/apiserver.key"
,
"--kubelet-client-certificate="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/apiserver.crt"
,
"--kubelet-client-key="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/apiserver.key"
,
"--token-auth-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/tokens.csv"
,
"--token-auth-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/tokens.csv"
,
fmt
.
Sprintf
(
"--secure-port=%d"
,
123
),
fmt
.
Sprintf
(
"--secure-port=%d"
,
123
),
"--allow-privileged"
,
"--allow-privileged"
,
...
@@ -420,6 +424,8 @@ func TestGetAPIServerCommand(t *testing.T) {
...
@@ -420,6 +424,8 @@ func TestGetAPIServerCommand(t *testing.T) {
"--client-ca-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/ca.crt"
,
"--client-ca-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/ca.crt"
,
"--tls-cert-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/apiserver.crt"
,
"--tls-cert-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/apiserver.crt"
,
"--tls-private-key-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/apiserver.key"
,
"--tls-private-key-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/apiserver.key"
,
"--kubelet-client-certificate="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/apiserver.crt"
,
"--kubelet-client-key="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/apiserver.key"
,
"--token-auth-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/tokens.csv"
,
"--token-auth-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/tokens.csv"
,
fmt
.
Sprintf
(
"--secure-port=%d"
,
123
),
fmt
.
Sprintf
(
"--secure-port=%d"
,
123
),
"--allow-privileged"
,
"--allow-privileged"
,
...
@@ -445,6 +451,8 @@ func TestGetAPIServerCommand(t *testing.T) {
...
@@ -445,6 +451,8 @@ func TestGetAPIServerCommand(t *testing.T) {
"--client-ca-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/ca.crt"
,
"--client-ca-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/ca.crt"
,
"--tls-cert-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/apiserver.crt"
,
"--tls-cert-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/apiserver.crt"
,
"--tls-private-key-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/apiserver.key"
,
"--tls-private-key-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/apiserver.key"
,
"--kubelet-client-certificate="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/apiserver.crt"
,
"--kubelet-client-key="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/apiserver.key"
,
"--token-auth-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/tokens.csv"
,
"--token-auth-file="
+
kubeadmapi
.
GlobalEnvParams
.
HostPKIPath
+
"/tokens.csv"
,
fmt
.
Sprintf
(
"--secure-port=%d"
,
123
),
fmt
.
Sprintf
(
"--secure-port=%d"
,
123
),
"--allow-privileged"
,
"--allow-privileged"
,
...
...
cmd/kubeadm/app/phases/certs/certs.go
View file @
6a37f450
...
@@ -123,6 +123,8 @@ func CreatePKIAssets(cfg *kubeadmapi.MasterConfiguration, pkiDir string) error {
...
@@ -123,6 +123,8 @@ func CreatePKIAssets(cfg *kubeadmapi.MasterConfiguration, pkiDir string) error {
config
:=
certutil
.
Config
{
config
:=
certutil
.
Config
{
CommonName
:
"kube-apiserver"
,
CommonName
:
"kube-apiserver"
,
AltNames
:
altNames
,
AltNames
:
altNames
,
// This makes the apiserver allowed to talk to the kubelets in the cluster
Organization
:
[]
string
{
"system:masters"
},
Usages
:
[]
x509
.
ExtKeyUsage
{
x509
.
ExtKeyUsageServerAuth
},
Usages
:
[]
x509
.
ExtKeyUsage
{
x509
.
ExtKeyUsageServerAuth
},
}
}
apiCert
,
apiKey
,
err
:=
pkiutil
.
NewCertAndKey
(
caCert
,
caKey
,
config
)
apiCert
,
apiKey
,
err
:=
pkiutil
.
NewCertAndKey
(
caCert
,
caKey
,
config
)
...
...
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