Commit Graph

3244 Commits

Author SHA1 Message Date
Lubomir I. Ivanov
4bb75a462f kubeadm: remove the CoreDNS check for supported image digests
The isCoreDNSVersionSupported() check assumes that
there is a running kubelet, that manages the CoreDNS containers.

If the containers are being created it is not possible to fetch
their image digest. To workaround that, a poll can be used in
isCoreDNSVersionSupported() and wait for the CoreDNS Pods
are expected to be running. Depending on timing and CNI
yet to be installed this can cause problems related to
addon idempotency of "kubeadm init", because if the CoreDNS
Pods are waiting for another step they will never get running.

Remove the function isCoreDNSVersionSupported() and assume that
the version is always supported. Rely on the Corefile migration
library to error out if it must.
2020-09-04 05:27:04 +03:00
Kubernetes Prow Robot
be1d43a097
Merge pull request #93992 from prabhu43/kubeadm-kubeconfig-clustername
Make clustername configurable in generation of kubeconfig using kubeadm command
2020-09-03 11:13:41 -07:00
Kubernetes Prow Robot
c19e050aee
Merge pull request #94299 from zouyee/pending
fix kubeadm update coredns with skip pending pod
2020-09-03 08:17:54 -07:00
Kubernetes Prow Robot
92ba3eb793
Merge pull request #93275 from xlgao-zju/check-mem
kubeadm: Add a preflight check that the control-plane node has at least 1700MB of RAM
2020-09-03 08:17:40 -07:00
Kubernetes Prow Robot
8e29d9563d
Merge pull request #94385 from loopever/fix-typo
fix typos in cmd/kubeadm
2020-09-03 03:41:55 -07:00
zounengren
fc0bda5a3c fix kubeadm update coredns with skip pending pod 2020-09-03 10:42:59 +08:00
Kubernetes Prow Robot
0b92e8b16d
Merge pull request #94421 from rosti/kubeadm-fix-upgrade-plan
kubeadm: Fix `upgrade plan` for air-gapped setups
2020-09-02 18:21:54 -07:00
Kubernetes Prow Robot
2c12a81cb7
Merge pull request #94398 from neolit123/1.20-pin-control-plane-to-local-endpoint
kubeadm: make the scheduler and KCM connect to the local API endpoint
2020-09-02 12:09:19 -07:00
Rostislav M. Georgiev
6e2a70eac7 kubeadm: Fix upgrade plan for air-gapped setups
A bug was discovered in the `enforceRequirements` func for `upgrade plan`.
If a command line argument that specifies the target Kubernetes version is
supplied, the returned `ClusterConfiguration` by `enforceRequirements` will
have its `KubernetesVersion` field set to the new version.
If no version was specified, the returned `KubernetesVersion` points to the
currently installed one.

This remained undetected for a couple of reasons
- It's only `upgrade plan` that allows for the version command line argument to
  be optional (in `upgrade plan` it's mandatory)
- Prior to 1.19, the implementation of `upgrade plan` did not make use of the
  `KubernetesVersion` returned by `enforceRequirements`.

`upgrade plan` supports this optional command line argument to enable
air-gapped setups (as not specifying a version on the command line will end up
looking for the latest version over the Interned).

Hence, the only option is to make `enforceRequirements` consistent in the
`upgrade plan` case and always return the currently installed version in the
`KubernetesVersion` field.

Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
2020-09-02 12:52:02 +03:00
Kubernetes Prow Robot
27df218c72
Merge pull request #93702 from thtanaka/feature/fix-kubeadm-reset
kubeadm: reset don't unmount /var/lib/kubelet if it is mounted
2020-09-01 23:13:08 -07:00
Kubernetes Prow Robot
d5e2db896e
Merge pull request #94395 from rosti/kubeadm-ensure-etcd-upgrades
kubeadm: Ensure etcd manifests are regenerated upon upgrade
2020-09-01 18:44:38 -07:00
Kubernetes Prow Robot
b49724d5fc
Merge pull request #94287 from jingyih/update_etcd_server_3p4p13
Update default etcd server to 3.4.13
2020-09-01 15:35:20 -07:00
Lubomir I. Ivanov
d9441906c4 kubeadm: make the scheduler and KCM connect to local endpoint
Pinning the kube-controller-manager and kube-scheduler kubeconfig files
to point to the control-plane-endpoint can be problematic during
immutable upgrades if one of these components ends up contacting an N-1
kube-apiserver:
https://kubernetes.io/docs/setup/release/version-skew-policy/#kube-controller-manager-kube-scheduler-and-cloud-controller-manager
For example, the components can send a request for a non-existing API
version.

Instead of using the CPE for these components, use the LocalAPIEndpoint.
This guarantees that the components would talk to the local
kube-apiserver, which should be the same version, unless the user
explicitly patched manifests.
2020-09-01 19:38:28 +03:00
Rostislav M. Georgiev
3bef5d2e0b kubeadm: Ensure etcd manifests are regenerated upon upgrade
A check that verifies that kubeadm does not "upgrade" to an older release was
overly optimized by skipping upgrade if the new version is the same as the old
one. This somewhat makes sense, but that way changes in any of the etcd fields
in the ClusterConfiguration won't be applied if the etcd version is not
changed.

Hence, this simple change ensures that the upgrade is done even when no version
change takes place.

Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
2020-09-01 15:47:33 +03:00
loopever
847e59186a fix typos in cmd/kubeadm 2020-09-01 10:09:45 +08:00
Hu Shuai
2be66feb49 Improve the prompt message when kubeadm init is successful
Signed-off-by: Hu Shuai <hus.fnst@cn.fujitsu.com>
2020-08-31 15:27:20 +08:00
jingyih
c96b93fbd4 Update default etcd server to 3.4.13 2020-08-28 21:19:24 +08:00
Kubernetes Prow Robot
a39f9dfde7
Merge pull request #93626 from vikkyomkar/issue-2237
[Cleanup] Removes usage of the k8s-master label (version marker)
2020-08-27 11:52:09 -07:00
Kubernetes Prow Robot
8297d5f195
Merge pull request #93483 from ZhiFeng1993/remove-false-positive-warning
Remove false positive warning in kubeadm cmd
2020-08-27 11:51:54 -07:00
Kubernetes Prow Robot
f542e86779
Merge pull request #93834 from loopever/master
fix typos in cmd/kubeadm and cmd/kube-scheduler
2020-08-27 10:38:06 -07:00
Kubernetes Prow Robot
be69ccc287
Merge pull request #94016 from mrueg/oyaml
kubeadm: Separate argument key/value in log msg
2020-08-27 04:49:16 -07:00
Prabhu Jayakumar
bdd0ccaddb
Allow to configure clustername in creation of kubeconfig using kubeadm command
Signed-off-by: Prabhu Jayakumar <j.prabhu91@gmail.com>
2020-08-20 22:59:23 +05:30
Manuel Rüger
f289a3d6a7 kubeadm: Separate argument key/value in log msg
Users might be more used to `-o yaml` instead of -oyaml and get
confused event if the command works.

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2020-08-14 23:49:07 +02:00
RobertKielty
737548a6b2 go fmt fix 2020-08-13 06:03:58 +01:00
RobertKielty
1eb1690a92 names unnamed testcases, adds name to t.Errorf msg 2020-08-12 00:22:38 +01:00
loopever
b645f3038e Fix some typo 2020-08-11 08:35:31 +08:00
ZhiFeng1993
b90228f52f Remove false positive warning in kubeadm cmd 2020-08-06 12:45:55 -07:00
Thomas Tanaka
2e2d0845cd kubeadm: reset don't unmount /var/lib/kubelet if it is mounted
Previous PR that fixes this
https://github.com/kubernetes/kubernetes/pull/71663

Signed-off-by: Thomas Tanaka <thomas.tanaka@gmail.com>
2020-08-05 13:15:56 -07:00
vikkyomkar
f505f10e94 removed k8s-master label 2020-08-01 15:52:18 +05:30
Xianglin Gao
c6975a7750 add test case for kubeadm memory check
Signed-off-by: Xianglin Gao <xianglin.gxl@alibaba-inc.com>
2020-07-24 10:57:22 +08:00
Xianglin Gao
e5bb66f899 Add a preflight check that the control-plane node has at least 2GB RAM
Signed-off-by: Xianglin Gao <xianglin.gxl@alibaba-inc.com>
2020-07-20 23:58:31 +08:00
Kubernetes Prow Robot
f9ad7db9a6
Merge pull request #92349 from jingyih/update_etcd_server_3p4p9
Update default etcd server to 3.4.9
2020-07-17 07:53:01 -07:00
Kubernetes Prow Robot
19f0a54d6b
Merge pull request #92183 from wallrj/2163-csr-only-external-ca-mode-2
kubeadm alpha certs generate-csr
2020-07-13 07:18:32 -07:00
Kubernetes Prow Robot
f41a20444a
Merge pull request #92881 from neolit123/1.19-deprecate-kubeadm-dkc
kubeadm: deprecate "kubeadm alpha kubelet config enable-dynamic"
2020-07-12 06:58:29 -07:00
Kubernetes Prow Robot
3727879ea5
Merge pull request #92651 from rajansandeep/kubeadm-coredns1.7.0
[Kubeadm]:Bump CoreDNS to v1.7.0
2020-07-10 15:40:51 -07:00
Kubernetes Prow Robot
82baa26905
Merge pull request #92753 from QianChenglong/fix/kubeadm-altnames
kubeadm: remove duplicate DNS names and IP addresses from generated certificates
2020-07-09 09:10:20 -07:00
Sandeep Rajan
04038fc791 update coredns version to 1.7.0 2020-07-09 11:01:45 -04:00
Richard Wall
81554ffdc0 kubeadm alpha certs generate-csr
* Creates private keys and CSR files for all the control-plane certificates
* Helps with External CA mode of kubeadm

Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2020-07-09 06:16:22 +01:00
Richard Wall
57712220a1 Add new helper functions for creating keys, kubeconfig and CSR files
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2020-07-09 06:16:22 +01:00
Richard Wall
21153e7b6a Deprecate --csr-only and --csr-dir flags
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2020-07-08 22:14:00 +01:00
jingyih
e9bf1c3c90 Update default etcd server to 3.4.9 2020-07-08 14:16:40 +08:00
Kubernetes Prow Robot
bf94f27e76
Merge pull request #92716 from rajansandeep/removefederation
[kubeadm]: Remove kube-dns translation for federation
2020-07-07 19:55:06 -07:00
Lubomir I. Ivanov
5777e8740e kubeadm: deprecate "kubeadm alpha kubelet config enable-dynamic"
Deprecate the command and recommend users to follow the
official guide at the k8s.io website instead.
2020-07-07 22:15:43 +03:00
Rostislav M. Georgiev
d023f3d25d kubeadm: Cleanup and refactor the LoadJoinConfigurationFromFile test
Back in the v1alpha2 days the fuzzer test needed to be disabled. To ensure that
there were no config breaks and everything worked correctly extensive replacement
tests were put in place that functioned as unit tests for the kubeadm config utils
as well.

The fuzzer test has been reenabled for a long time now and there's no need for
these replacements. Hence, over time most of these were disabled, deleted and
refactored. The last remnants are part of the LoadJoinConfigurationFromFile test.

The test data for those old tests remains largely unused today, but it still receives
updates as it contains kubelet's and kube-proxy's component configs. Updates to these
configs are usually done because the maintainers of those need to add a new field.

Hence, to cleanup old code and reduce maintenance burden, the last test that depends
on this test data is finally refactored and cleaned up to represent a simple unit test
of `LoadJoinConfigurationFromFile`.

Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
2020-07-03 20:00:49 +03:00
Rostislav M. Georgiev
930ca6ceb2 kubeadm: Refactor component config tests
Over the course of recent development of the `componentconfigs` package,
it became evident that most of the tests in this package cannot be implemented without
using a component config. As all of the currently supported component configs are
external to the kubeadm project (kubelet and kube-proxy), practically all of the tests
in this package are now dependent on external code.
This is not desirable, because other component's configs may change frequently and
without much of a notice. In particular many configs add new fields without bumping their
versions. In addition to that, some components may be deprecated in the future and many
tests may use their configs as a place holder of a component config just to test some
common functionality.
To top that, there are many tests that test the same common functionality several times
(for each different component config).

Thus a kubeadm managed replacement and a fake test environment are introduced.
The new test environment uses kubeadm's very own `ClusterConfiguration`.
ClusterConfiguration is normally not managed by the `componentconfigs` package.
It's only used, because of the following:
- It's a versioned API that is under the control of kubeadm maintainers. This enables us to test
  the componentconfigs package more thoroughly without having to have full and always up to date
  knowledge about the config of another component.
- Other components often introduce new fields in their configs without bumping up the config version.
  This, often times, requires that the PR that introduces such new fields to touch kubeadm test code.
  Doing so, requires more work on the part of developers and reviewers. When kubeadm moves out of k/k
  this would allow for more sporadic breaks in kubeadm tests as PRs that merge in k/k and introduce
  new fields won't be able to fix the tests in kubeadm.
- If we implement tests for all common functionality using the config of another component and it gets
  deprecated and/or we stop supporting it in production, we'll have to focus on a massive test refactoring
  or just continue importing this config just for test use.

Thus, to reduce maintenance costs without sacrificing test coverage, we introduce this mini-framework
and set of tests here which replace the normal component configs with a single one (`ClusterConfiguration`)
and test the component config independent logic of this package.

As a result of this, many of the older test cases are refactored and greatly simplified to reflect
on the new change as well. The old tests that are strictly tied to specific component configs
(like the defaulting tests) are left unchanged.

Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
2020-07-03 20:00:45 +03:00
Kubernetes Prow Robot
af29f81af6
Merge pull request #92740 from SataQiu/deprecate-config-view-20200702
Mark 'kubeadm config view' command as deprecated
2020-07-03 05:04:02 -07:00
Kubernetes Prow Robot
046ac5100e
Merge pull request #92720 from neolit123/1.19-add-kcm-port
kubeadm: add --port=0 for kube-controller-manager and kube-scheduler
2020-07-03 05:03:25 -07:00
Kubernetes Prow Robot
a2aaae2dd5
Merge pull request #88124 from rosti/kubeadm-cc-upgrade-plan
kubeadm upgrade plan: print a component config state table
2020-07-03 05:02:47 -07:00
QianChenglong
883f318df4 Fix duplicate altnames in cert 2020-07-03 12:14:36 +08:00
SataQiu
2b7af10276 mark 'kubeadm config view' command as deprecated 2020-07-03 09:40:23 +08:00