Commit Graph

3733 Commits

Author SHA1 Message Date
SataQiu
d57e442c62 kubeadm: do not check if the /etc/kubernetes/manifests folder is empty on joining worker nodes during preflight
Signed-off-by: SataQiu <shidaqiu2018@gmail.com>
2021-09-14 20:26:04 +08:00
Haleygo
46454ea9dc support null resolvConf in Kubelet Configuration 2021-09-14 16:12:52 +08:00
Paco Xu
1385bd3a06 kubeadm: fix ut failures of dualstack GA 2021-09-14 13:16:40 +08:00
Kubernetes Prow Robot
c79f7c1add
Merge pull request #104711 from claudiubelu/update-pause-3.6
update pause image references to use 3.6
2021-09-13 19:09:08 -07:00
Paco Xu
d57bad5fa9 Update cmd/kubeadm/app/preflight/checks.go
Co-authored-by: Lubomir I. Ivanov <neolit123@gmail.com>
2021-09-14 09:33:12 +08:00
Paco Xu
7007b417e5 kubeadm: move swap on check error to warning since NodeSwap is beta in 1.23 2021-09-14 09:33:12 +08:00
RA489
2a96e22c0a remove the --csr* flags from "kubeadm certs renew" 2021-09-13 14:50:33 +05:30
Paco Xu
a0cc3f1c9a cleanup: DualStack GA for kubeadm 2021-09-04 22:38:14 +08:00
Claudiu Belu
18936d4785 updates pause image references
The pause:3.6 image has been published.

Also updates older / incorrect references.
2021-08-29 21:50:05 -07:00
la3mmchen
57f2af2834 FIX: just add a missing word in output 2021-08-25 21:53:49 +02:00
Stephen Augustus
481cf6fbe7
generated: Run hack/update-gofmt.sh
Signed-off-by: Stephen Augustus <foo@auggie.dev>
2021-08-24 15:47:49 -04:00
Antonio Ojea
0cd75e8fec run hack/update-netparse-cve.sh 2021-08-20 10:42:09 +02:00
XinYang
72fd01095d
re-order imports for kubeadm
Signed-off-by: XinYang <xinydev@gmail.com>
2021-08-17 22:40:46 +08:00
Lubomir I. Ivanov
096c3e8f2d kubeadm: further improve the dynamic version population
Panicing if not running in a test and if the component-base/version
variables are empty is not ideal. At some point sections
of kubeadm could be exposed as a library and if these sections
import the constants package, they would panic on the library
users unless they set the version information in component-base
with ldflags.

Instead:
- If the component-base version is empty, return a placeholder version
that should indicate to users that build kubeadm that something is not
right (e.g. they did not use 'make'). During library usage or unit
tests this version should not be relevant.
- Update unit tests to use hardcoded versions instead of the versions
from the constants package. Using the constants package for testing
is good but during unit tests these versions are already placeholders
since unit tests do not populate the actual component-base versions
(e.g. 1.23).
2021-08-12 19:54:06 +03:00
Kubernetes Prow Robot
746fea56ae
Merge pull request #104065 from pacoxu/kubeadm-patches
kubeadm: disallow the mixture of --config and --patches & remove deprecated --experimental-patches
2021-08-11 08:06:58 -07:00
Benjamin Elder
e6cb526f6b set umask on linux and darwin when testing kubeadm copycerts 2021-08-10 22:42:35 -07:00
Kubernetes Prow Robot
40c9066054
Merge pull request #103027 from Haleygo/feature/add-kubeadm-join-dryrun
kubeadm: support kubeadm join --dry-run
2021-08-10 13:02:39 -07:00
Haleygo
95e000fd65 support kubeadm join dry-run 2021-08-10 23:43:54 +08:00
Kubernetes Prow Robot
e96652ea74
Merge pull request #104015 from neolit123/1.23-use-dynamic-versions
kubeadm: dynamically populate the current/minimum k8s versions
2021-08-09 21:59:17 -07:00
Lubomir I. Ivanov
e3538edc22 kubeadm: update unit tests to support dynamic version updates
Tests under /app and /test would fail if the current/minimum k8s version
is dynamically populated from the version in the kubeadm binary.
Adapt the tests to support that.
2021-08-09 19:42:08 +03:00
Lubomir I. Ivanov
207ffa7bdc kubeadm: dynamically populate the current/minimum k8s versions
Kubeadm requires manual version updates of its current supported k8s
control plane version and minimally supported k8s control plane and
kubelet versions every release cycle.

To avoid that, in constants.go:
- Add the helper function getSkewedKubernetesVersion() that can be
used to retrieve a MAJOR.(MINOR+n).0 version of k8s. It currently
uses the kubeadm version populated in "component-base/version" during
the kubeadm build process.
- Use the function to set existing version constants (variables).

Update util/config/common.go#NormalizeKubernetesVersion() to
tolerate the case where a k8s version in the ClusterConfiguration
is too old for the kubeadm binary to use during code freeze.

Include unit tests for the new utilities.
2021-08-09 19:42:08 +03:00
Kubernetes Prow Robot
5eeaafd2b4
Merge pull request #104157 from knight42/remove-port-from-kubeadm-manifest
refactor(kubeadm): remove the flag --port from KCM manifest
2021-08-05 16:37:10 -07:00
Kubernetes Prow Robot
de4e500673
Merge pull request #104134 from ihgann/topic/ganni/optimize-kubeadm-etcd-member-add-2
kubeadm: reduce the backoff time of AddMember for etcd
2021-08-05 16:37:03 -07:00
Kubernetes Prow Robot
8df554bafd
Merge pull request #103801 from gkarthiks/master
Remove purell package usage from kubeadm
2021-08-05 14:09:56 -07:00
Ian Gann
c8431f42d9 kubeadm: Reduce the backoff time of AddMember for etcd
This change optimizes the kubeadm/etcd `AddMember` client-side function
by stopping early in the backoff loop when a peer conflict is found
(indicating the member has already been added to the etcd cluster). In
this situation, the function will stop early and relay a call to
`ListMembers` to fetch the current list of members to return. With this
optimization, front-loading a `ListMembers` call is no longer necessary,
as this functionally returns the equivalent response.

This helps reduce the amount of time taken in situational cases where an
initial client request to add a member is accepted by the server, but
fails client-side.

This situation is possible situationally, such as if network latency
causes the request to timeout after it was sent and accepted by the
cluster. In this situation, the following loop would occur and fail with
an `ErrPeerURLExist` response, and would be stuck until the backoff
timeout was met (roughly ~2min30sec currently).

Testing Done:

* Manual testing with an etcd cluster. Initial "AddMember` call was
  successful, and the etcd manifest file was identical to prior version
  of these files. Subsequent calls to add the same member succeeded
  immediately (retaining idempotency), and the resulting manifest file
  remains identical to previous version as well. The difference, this
  time, is the call finished ~2min25sec faster in an identical test in
  the environment tested with.
2021-08-05 13:11:42 -07:00
Jian Zeng
c486b229d2 refactor(kubeadm): remove the flag --port from KCM manifest
Signed-off-by: Jian Zeng <zengjian.zj@bytedance.com>
2021-08-05 19:51:02 +08:00
Kubernetes Prow Robot
90ac41bd77
Merge pull request #103813 from SataQiu/update-kubeadm-ci-bucket
kubeadm: update references to legacy artifacts locations
2021-08-05 01:44:27 -07:00
paco
b7ea7a7766 kubeadm: disallow the mixture of --config and --patches 2021-08-02 10:20:31 +08:00
paco
375ef778c4 kubeadm: remove deprecated --experimental-patches 2021-08-02 10:10:20 +08:00
Kevin Delgado
ca90849724 add kube-openapi/pkg/schemaconv to kubeadm import-restrictions 2021-07-28 01:06:15 +00:00
SataQiu
5be47eaf27 kubeadm: update references to legacy artifacts locations 2021-07-21 12:13:05 +08:00
gkarthiks
019e8f71b6 refactor: normalizing URL string locally and move out from purell package
The purell package at github.com/PuerkitoBio/purell is no longer maintained and in k/k repo under kubeadm package its been used for normalizing the URL. This commit removes the dependency on this package and creates a local function for normalizing the URL within the preflight package under cmd/kubeadm.

Signed-off-by: gkarthiks <github.gkarthiks@gmail.com>

chore: add new line at end of the file

Signed-off-by: gkarthiks <github.gkarthiks@gmail.com>

fix: remove unused mod from vendor modules file

Signed-off-by: gkarthiks <github.gkarthiks@gmail.com>
2021-07-20 21:56:08 +05:30
Lubomir I. Ivanov
6cf3e36c37 kubeadm: statically default the "from cluster" InitConfiguration
During operations such as "upgrade", kubeadm fetches the
ClusterConfiguration object from the kubeadm ConfigMap.
However, due to requiring node specifics it wraps it in an
InitConfiguration object. The function responsible for that is:
  app/util/config#FetchInitConfigurationFromCluster().

A problem with this function (and sub-calls) is that it ignores
the static defaults applied from versioned types
(e.g. v1beta3/defaults.go) and only applies dynamic defaults for:
- API endpoints
- node registration
- etc...

The introduction of Init|JoinConfiguration.ImagePullPolicy now
has static defaulting of the NodeRegistration object with a default
policy of "PullIfNotPresent". Respect this defaulting by constructing
a defaulted internal InitConfiguration from
FetchInitConfigurationFromCluster() and only then apply the dynamic
defaults over it.

This fixes a bug where "kubeadm upgrade ..." fails when pulling images
due to an empty ("") ImagePullPolicy. We could assume that empty
string means default policy on runtime in:
cmd/kubeadm/app/preflight/checks.go#ImagePullCheck()

but that might actually not be the user intent during "init" and "join",
due to e.g. a typo. Similarly, we don't allow empty tokens
on runtime and error out.
2021-07-08 02:52:11 +03:00
Kubernetes Prow Robot
ac554af79b
Merge pull request #103142 from serathius/etcd-3.5.0
Upgrade etcd to 3.5.0
2021-07-07 12:40:22 -07:00
Kubernetes Prow Robot
656d00e894
Merge pull request #103496 from neolit123/1.22-add-defaulting-v1beta3-imagepull
kubeadm: statically default ImagePullPolicy in v1beta3
2021-07-06 22:11:48 -07:00
Lubomir I. Ivanov
f01d251e38 kubeadm: statically default ImagePullPolicy in v1beta3
Instead of dynamically defaulting NodeRegistration.ImagePullPolicy,
which is common when doing defaulting depending on host state - e.g.
hostname, statically default it in v1beta3/defaults.go.

- Remove defaulting in checks.go
- Add one more unit test in checks_test.go
- Adapt v1beta2 conversion and fuzzer / round tripping tests

This also results in the default being visible when calling:
"kubeadm config print ...".
2021-07-05 21:48:06 +03:00
Lubomir I. Ivanov
94414bea47 kubeadm: fix godoc formatting for v1beta3
Fix indentation of entries in the changelog and the migration steps.
2021-07-05 20:52:18 +03:00
Kubernetes Prow Robot
120f6325a7
Merge pull request #103471 from pacoxu/patch-1
kubeadm: fix nil pointer in  Cfg() feature gate checking
2021-07-04 23:06:53 -07:00
Paco Xu
772344aef2
kubeadm: fix nil pointer in Cfg() feature gate checking 2021-07-05 09:59:57 +08:00
XinYang
c2a8cd359f
re-order the imports in kubeadm
Signed-off-by: XinYang <xinydev@gmail.com>

Update cmd/kubeadm/app/cmd/join.go

Co-authored-by: Lubomir I. Ivanov <neolit123@gmail.com>
2021-07-04 16:41:27 +08:00
Kubernetes Prow Robot
5fe522c237
Merge pull request #101988 from vinayakankugoyal/kubeadm
Remove users and groups created as part of rootless control-plane in kubeadm.
2021-07-02 23:42:17 -07:00
Vinayak Goyal
1ae9b8f04d Update kernel components to run as non-root in kubeadm. 2021-07-02 17:37:55 -07:00
Kubernetes Prow Robot
1345a802de
Merge pull request #103187 from Haleygo/fix-dry-run-when-using-externalCA
Kubeadm init --dry-run should work when using an external ca
2021-07-02 07:58:25 -07:00
Haleygo
6d6d200c3a dry-run can work when using an external ca 2021-07-02 18:53:51 +08:00
Lubomir I. Ivanov
622f69bf8d kubeadm: update v1beta3's godoc changelog 2021-07-02 00:12:25 +03:00
Lubomir I. Ivanov
11d444b00e kubeadm: remove versioned copies of the bootstrap token API and utils
Given bootstraptoken/v1 is now a separate GV, there is no need
to duplicate the API and utilities inside v1beta3 and the internal
version.

v1beta2 must continue to use its internal copy due, since output/v1alpha1
embeds the v1beta2.BootstrapToken object. See issue 2427 in k/kubeadm.
2021-07-02 00:11:49 +03:00
Lubomir I. Ivanov
14fa296bb3 kubeadm: use the bootstraptoken/v1 API across the code base
- Make v1beta3 use bootstraptoken/v1 instead of local copies
- Make the internal API use bootstraptoken/v1
- Update validation, /cmd, /util and other packages
- Update v1beta2 conversion
2021-07-02 00:11:49 +03:00
Lubomir I. Ivanov
5b7bda90c0 kubeadm: introduce apis/bootstraptoken/v1
Package bootstraptoken contains an API and utilities wrapping the
"bootstrap.kubernetes.io/token" Secret type to ease its usage in kubeadm.

The API is released as v1, since these utilities have been part of a
GA workflow for 10+ releases.

The "bootstrap.kubernetes.io/token" Secret type is also GA.
2021-07-02 00:11:49 +03:00
Kubernetes Prow Robot
3f4c39bbd7
Merge pull request #103063 from neolit123/1.22-add-patches-to-v1beta3
kubeadm: add support for patches in v1beta3; deprecate --experimental-patches
2021-07-01 02:25:54 -07:00
Vinayak Goyal
1c39cf2365 Fix incorrect user and group for kube-scheduler when it is running as non-root. 2021-06-30 11:28:15 -07:00
Lubomir I. Ivanov
5c00024c70 kubeadm: fix wrong check for keys/certs during "download-certs"
During "join" of new control plane machines, kubeadm would
download shared certificates and keys from the cluster stored
in a Secret. Based on the contents of an entry in the Secret,
it would use helper functions from client-go to either write
it as public key, cert (mode 644) or as a private key (mode 600).

The existing logic is always writing both keys and certs with mode 600.
Allow detecting public readable data properly and writing some files
with mode 644.

First check the data with ParsePrivateKeyPEM(); if this passes
there must be at least one private key and the file should be written
with mode 600 as private. If that fails, validate if the data contains
public keys with ParsePublicKeysPEM() and write the file as public
(mode 644).

As a result of this new logic, and given the current set of managed
kubeadm files, .key files will end up with 600, while .crt and .pub
files will end up with 644.
2021-06-29 23:42:04 +03:00
wangyysde
39a373b162 correct example command of kubeadm help
Signed-off-by: wangyysde <net_use@bzhy.com>
2021-06-28 16:12:52 +08:00
navist2020
538e7777c3 kubeadm:remove deprecated flags CSROnly and CSRDir 2021-06-24 18:28:43 +08:00
Marek Siarkowicz
ebe550bd48 Upgrade etcd to 3.5.0 2021-06-24 09:15:17 +02:00
Lubomir I. Ivanov
70a524659a kubeadm: add {Init|Join}Configuration.Patches.Directory to v1beta3
Add {Init|Join}Configuration.Patches, which is a structure that
contains patch related options. Currently it only has the "Directory"
field which is the same option as the existing --experimental-patches
flag.

The flags --[experimental-]patches value override this value
if both a flag and config is passed during "init" or "join".
2021-06-23 22:24:10 +03:00
Lubomir I. Ivanov
a4402122b4 kubeadm: add the --patches flag and deprecate --experimental-patches
The feature of "patches" in kubeadm has been in Alpha for a few
releases. It has not received major bug reports from users.
Deprecate the --experimental-patches flag and add --patches.

Both flags are allowed to be mixed with --config.
2021-06-23 22:22:41 +03:00
Lubomir I. Ivanov
3b36e6bcea kubeadm: fix image pull policy integration
If the user has not specified a pull policy we must assume a default of
v1.PullIfNotPresent.

Add some extra verbose output to help users monitor what policy is
used and what images are skipped / pulled.

Use "fallthrough" and case handle "v1.PullAlways".

Update unit test.
2021-06-23 00:52:35 +03:00
Kubernetes Prow Robot
c864f2357d
Merge pull request #102901 from wangyysde/add-support-imagePullPolicy-fix524
kubeadm: add support of imagePullPolicy to kubeadm
2021-06-22 07:43:59 -07:00
Kubernetes Prow Robot
e78e692f33
Merge pull request #101449 from CaoDonghui123/fix5
kubeadm: allow passing the flag --log-file if --config is passed
2021-06-21 20:43:57 -07:00
caodonghui
25f479c2ac fix'--log-file only works if --logtostderr=false' 2021-06-22 09:32:26 +08:00
Kubernetes Prow Robot
cfa0130b9f
Merge pull request #102466 from pacoxu/dns-1.8.4
kubeadm: update coredns to 1.8.4
2021-06-21 18:14:10 -07:00
wangyysde
459fe7d08a add support of imagePullPolicy to kubeadm
Signed-off-by: wangyysde <net_use@bzhy.com>
2021-06-22 07:13:25 +08:00
navist2020
1f9d448283 Use errors.Errorf instead of errors.Wrapf when the err is nil 2021-06-21 16:17:32 +08:00
Kubernetes Prow Robot
ab7d8b5b5b
Merge pull request #102871 from rainrambler/patch-1
kubeadm: use defer to unlock mutex in certs.go
2021-06-18 09:52:30 -07:00
Kubernetes Prow Robot
f1d9db4381
Merge pull request #102940 from gy95/sche
when new manager failed should return err
2021-06-17 14:08:17 -07:00
Kubernetes Prow Robot
b41c8a2d49
Merge pull request #102862 from vinayakankugoyal/roochless2
Update etcd in kubeadm to run as non-root.
2021-06-17 13:00:05 -07:00
navist2020
1a4b0ee09b remove excess error handling 2021-06-17 17:34:57 +08:00
gy95
c789898f79 when new manager failed should return err 2021-06-17 16:02:31 +08:00
Vinayak Goyal
5a0756c5f4 Update etcd in kubeadm to run as non-root. 2021-06-16 17:30:46 -07:00
Kubernetes Prow Robot
3c1db414da
Merge pull request #102546 from lunhuijie/refactorCheckTest
refactor cmd/kubeadm/app/preflight/checks_test.go
2021-06-16 09:44:12 -07:00
刁浩 10284789
84112d3690 refactor cmd/kubeadm/app/preflight/checks_test.go()
Signed-off-by: 刁浩 10284789 <diao.hao@zte.com.cn>
2021-06-16 01:46:27 +00:00
Kubernetes Prow Robot
3a47ddccdf
Merge pull request #100488 from liggitt/protobuf
update etcd, grpc, protobuf dependencies
2021-06-15 14:49:42 -07:00
Kubernetes Prow Robot
d186b43639
Merge pull request #102828 from MikeSpreitzer/fix-kubeadm-api-dox
Fix some typos and omissions in kubeadm APIs
2021-06-15 11:31:43 -07:00
Jordan Liggitt
2979c3325e Switch to go.etcd.io/etcd/client/v3 2021-06-15 09:53:06 -04:00
rainrambler
5ea3dd531c
Update certs.go
Use defer feature for unlock
2021-06-15 15:34:26 +08:00
Antonio Ojea
74feb07594 kubeadm: CoreDNS permissions for endpointslices
Signed-off-by: Antonio Ojea <antonio.ojea.garcia@gmail.com>
Co-authored-by: pacoxu <paco.xu@daocloud.io>
2021-06-15 13:03:48 +08:00
pacoxu
188193e1c0 kubeadm: upgrade coredns 1.8.4 and corefile-migration to v1.0.12
Signed-off-by: pacoxu <paco.xu@daocloud.io>
2021-06-15 13:03:42 +08:00
Mike Spreitzer
a3e464490a Fix some typos and omissions in kubeadm APIs 2021-06-14 20:38:43 -04:00
Kubernetes Prow Robot
8a6a26714c
Merge pull request #102759 from vinayakankugoyal/roochless
Update kubeadm control-plane to run as non-root.
2021-06-14 15:52:01 -07:00
Vinayak Goyal
59b4b124df Update kubeadm control-plane to run as non-root. 2021-06-14 12:04:50 -07:00
Kubernetes Prow Robot
4aae71695a
Merge pull request #102366 from cndoit18/fix-time-format
fix(timezone): Change the time zone in the api data to UTC
2021-06-11 06:54:59 -07:00
Kubernetes Prow Robot
e52b7be7d7
Merge pull request #101600 from KofClubs/fix-cri-socket-kubeadm
kubeadm: disallow the mixture of --cri-socket and --config
2021-06-11 00:04:58 -07:00
Kubernetes Prow Robot
faa36554c5
Merge pull request #102770 from pacoxu/kubeadm-example
kubeadm: use a suggested example in v1beta2/3 docs
2021-06-10 08:23:47 -07:00
Kubernetes Prow Robot
f008ba0fed
Merge pull request #102062 from serathius/etcd-server
Update Etcd server image to 3.5.0-rc.0-0
2021-06-10 08:23:27 -07:00
pacoxu
654ec0866a kubeadm: use a suggested example in v1beta2/3 docs
Co-authored-by: SataQiu <shidaqiu2018@gmail.com>
2021-06-10 18:24:59 +08:00
Vinayak Goyal
e6bf19bcf6 Update CreateInitStaticPodManifestFiles, CreateStaticPodFiles and CreateLocalEtcdStaticPodManifestFile to take into account if the command was run as dry-run. 2021-06-09 15:01:42 -07:00
Marek Siarkowicz
12447bc803 Upgrade etcd server version to 3.5.0-rc.0 2021-06-09 17:00:05 +02:00
Kubernetes Prow Robot
7696a48612
Merge pull request #102560 from navist2020/todo/checkManifest
kubeadm:Run preflight checks for diff to check that the manifests already exist
2021-06-08 23:03:47 -07:00
Kubernetes Prow Robot
d849d9d057
Merge pull request #102697 from mlevesquedion/update-levee-analyzer-version
Update version of go-flow-levee for verify-govet-levee check.
2021-06-08 18:37:46 -07:00
navist2020
897f8012fd kubeadm:Run preflight checks for diff to check that the manifests already exist 2021-06-09 09:09:00 +08:00
Kubernetes Prow Robot
d5685397e1
Merge pull request #102673 from jackfrancis/kubeadm-etcd-ephemeral-storage
kubeadm: remove ephemeral-storage etcd requirement
2021-06-08 12:26:36 -07:00
Michaël Lévesque-Dion
a94aa0ea9a Update version of go-flow-levee for verify-govet-levee check. 2021-06-08 12:02:46 -04:00
Jack Francis
ff164f9013 feat: remove ephemeral-storage etcd requirement 2021-06-07 16:03:10 -07:00
Kubernetes Prow Robot
a8a379d91e
Merge pull request #102604 from vinayakankugoyal/kubeadm-files2
Add utils to set file/directory owners and permissions.
2021-06-07 13:40:56 -07:00
Vinayak Goyal
bb6151906f Add utils to set file/directory owners and permissions. 2021-06-07 11:31:38 -07:00
Kubernetes Prow Robot
3b71dac6ac
Merge pull request #102593 from CaoDonghui123/fix7
remove redundant code
2021-06-04 09:44:38 -07:00
caodonghui
812a04539c remove redundant code 2021-06-04 17:56:46 +08:00
cndoit18
51717256f9
fix(timezone): the timezone is standardized to UTC
Signed-off-by: cndoit18 <cndoit18@outlook.com>
2021-06-03 23:55:39 +08:00
Lubomir I. Ivanov
f6d015be7a kubeadm: add utilities to manage users and groups
In the Alpha stage of the feature in kubeadm to support
a rootless control plane, the allocation and assignment of
UID/GIDs to containers in the static pods will be automated.
This automation will require management of users and groups
in /etc/passwd and /etc/group.

The tools on Linux for user/group management are inconsistent
and non-standardized. It also requires us to include a number of
more dependencies in the DEB/RPMs, while complicating the UX for
non-package manager users.

The format of /etc/passwd and /etc/group is standardized.
Add code for managing (adding and deleting) a set of managed
users and groups in these files.
2021-06-03 03:48:45 +03:00
Kubernetes Prow Robot
7e2b5f3325
Merge pull request #102502 from ykakarap/kubeadm-coredns-path-change
kubeadm: use subpath for coredns only for default repository
2021-06-01 16:02:47 -07:00