Commit Graph

40 Commits

Author SHA1 Message Date
Etienne Champetier
64eef3e9fa kubeadm: set priority for "system-node-critical" Pods
Priority is normally set by the admission controller when missing.
For static pods there seems to be some corner cases, as, if priority
is not explicitly set, Graceful Node Shutdown will shutdown
static pods with the other pods that have priority 0 or unset.

Signed-off-by: Etienne Champetier <e.champetier@ateme.com>
2022-12-07 14:19:28 -05:00
ahrtr
972dc46a1f replace deprecated io/ioutil with os and io for cmd 2022-02-01 13:59:41 +08:00
haoyun
cd3bafc2ed cleanup: remove insecure flag
Signed-off-by: haoyun <yun.hao@daocloud.io>
2021-12-09 12:36:29 +08:00
XinYang
72fd01095d
re-order imports for kubeadm
Signed-off-by: XinYang <xinydev@gmail.com>
2021-08-17 22:40:46 +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
Vinayak Goyal
9ae671a5d4 Add seccomp profile runtime default to add control-plane components. 2021-05-06 18:27:56 -07:00
Lubomir I. Ivanov
8ece27bf4b kubeadm: remove the --experimental-kustomize feature
The feature was replaced by --experimental-patches and deprecated in
1.19.
2020-09-18 03:49:53 +03:00
Lubomir I. Ivanov
ceb768ccbd kubeadm: apply patches to static Pods
Add PatchStaticPod() in staticpod/utils.go

Apply patches to static Pods in:
- phases/controlplane/CreateStaticPodFiles()
- phases/etcd/CreateLocalEtcdStaticPodManifestFile() and
CreateStackedEtcdStaticPodManifestFile()

Add unit tests and update Bazel.
2020-06-26 02:14:47 +03:00
Lubomir I. Ivanov
83a59c02f9 kubeadm: switch control-plane static Pods to "system-node-critical"
Use the priority class "system-node-critical" to ensure
the control-plane static Pods have the highest possible priority.
2020-04-10 23:05:33 +03:00
Rafael Fernández López
b140c5d64b
kubeadm: remove ClusterStatus dependency
While `ClusterStatus` will be maintained and uploaded, it won't be
used by the internal `kubeadm` logic in order to determine the etcd
endpoints anymore.

The only exception is during the first upgrade cycle (`kubeadm upgrade
apply`, `kubeadm upgrade node`), in which we will fallback to the
ClusterStatus to let the upgrade path add the required annotations to
the newly created static pods.
2020-02-20 12:18:56 +01:00
Antonio Ojea
c0bc36c12e kubeadm: probe address for unspecified ips
kubeadm deploys the apiserver, controller-manager and the scheduler
using liveness probes.
The bind-address option is used to configure the probe address, in
case this is configured with an unspecified address, the probe
will fail. When using an unspecified address the probe host field is
left empty, otherwise the bind-address is used.
2020-01-04 00:42:15 +01:00
Antonio Ojea
7dc6c94395 kubeadm: use bind-address instead of address
kubeadm removed the deprecated "--address" flag for controller-manager
and scheduler in favor of "--bind-address"

We should use bind-address to configure the manifest probe addresses.
2019-12-20 22:03:49 +01:00
Antonio Ojea
335a3e9efb kubeadm: use correct IP family for etcd localhost
kubeadm always use the IPv4 localhost address by defaultA for etcd

The probe hostname is obtained before the generation of the etcd
parameters, so it can't detect the right IP familiy for the
host of the probe.
This causes that with IPv6 clusters doesn't work because the probe
uses the IPv4 localhost address.

This patchs configures the right localhost address based on the used
AdvertiseAddress IP family.
2019-11-30 17:25:30 +01:00
Lubomir I. Ivanov
99b64f1e8e kubeadm: use etcd's /health endpoint for it's liveness probe
Etcd v3.3.0 added the --listen-metrics-urls flag which allows specifying
addition URLs to the already present /health and /metrics endpoints.

While /health and /metrics are enabled for URLS defined with
--listen-client-urls (v3+ ?) they do require HTTPS.

Replace the present etcdctl based liveness probe with a standard HTTP
GET v1.Probe that connects to http://127.0.0.1:2381/health.

These endpoints are not reachable from the outside and only available
for localhost connections.
2019-08-16 01:06:49 +03:00
fabriziopandini
97181595f0 kubeadm-kustomize-core 2019-08-12 14:16:51 +02:00
Rafael Fernández López
30dc43ff86
kubeadm: set priority class name to system-cluster-critical for all master components
Remove the deprecated `scheduler.alpha.kubernetes.io/critical-pod` pod annotation and use
the `priorityClassName` first class attribute instead, setting all master components to
`system-cluster-critical`.
2019-02-12 17:50:36 +01:00
Rostislav M. Georgiev
80e2a3cf07 kubeadm: reduce the usage of InitConfiguration
For historical reasons InitConfiguration is used almost everywhere in kubeadm
as a carrier of various configuration components such as ClusterConfiguration,
local API server endpoint, node registration settings, etc.

Since v1alpha2, InitConfiguration is meant to be used solely as a way to supply
the kubeadm init configuration from a config file. Its usage outside of this
context is caused by technical dept, it's clunky and requires hacks to fetch a
working InitConfiguration from the cluster (as it's not stored in the config
map in its entirety).

This change is a small step towards removing all unnecessary usages of
InitConfiguration. It reduces its usage by replacing it in some places with
some of the following:

- ClusterConfiguration only.
- APIEndpoint (as local API server endpoint).
- NodeRegistrationOptions only.
- Some combinations of the above types, or if single fields from them are used,
  only those field.

Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
2019-01-28 12:21:01 +02:00
Ed Bartosh
47b4d8fc81 kubeadm: use T.Run API in app/util
Used T.Run API for kubeadm tests in app/util/
2018-12-29 18:27:38 +02:00
Lubomir I. Ivanov
24b4280e3f
Revert "kubeadm: Create control plane with ClusterFirstWithHostNet dns policy" 2018-11-14 00:18:32 +02:00
Lucas Käldström
5656338b6e
Update unit tests after the rename 2018-11-09 14:47:45 +02:00
Marek Counts
18dc529d05 Removed feature gates selfhosting, HA and store certs in secrets.
Added new alpha command to pivot to self hosted
Removed slelfhosting upgrade ability
Added warning message to self hosted pivot
added certs in secrets flag to new selfhosting comand
2018-11-07 11:44:54 -05:00
Rostislav M. Georgiev
d14c27a347 kubeadm: Control plane config moved to substructs
In v1alpha3's, control plane component config options were nested directly into
the ClusterConfiguration structure. This is cluttering the config structure and
makes it hard to maintain. Therefore the control plane config options must be
separated into different substructures in order to graduate the format to beta.

This change does the following:

- Introduces a new structure called ControlPlaneComponent, that contains fields
  common to all control plane component types. These are currently extra args
  and extra volumes.

- Introduce a new structure called APIServer that contains
  ControlPlaneComponent and APIServerCertSANs field (from ClusterConfiguration)

- Replace all API Server, Scheduler and Controller Manager options in
  ClusterConfiguration with APIServer, ControllerManager and Scheduler fields
  of APIServer and ControlPlaneComponent types.

Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
2018-11-02 11:38:56 +02:00
k8s-ci-robot
46ec13cf7d
Merge pull request #70027 from bart0sh/PR0031-kubeadm-sort-volumes
kubeadm: sort pod Volumes and VolumeMounts
2018-10-22 22:46:42 -07:00
Ed Bartosh
ebb0af9e8f kubeadm: sort pod Volumes and VolumeMounts
Order of Volumes and VolumeMounts in the pod objects created by
kubeadm is undefined as they're represended as maps in the
controlPlaneHostPathMounts struct.

This influences 'kubeadm upgrade' logic in a way that even when
manifest of the component is not changed kubeadm tries to upgrade
it because most of the time current and new pods are not equal
due to the different order of Volumes and VolumeMounts.

For example 'kubeadm apply diff' almost always shows difference
in Volumes and VolumeMounts because of this:
     volumeMounts:
+    - mountPath: /etc/kubernetes/pki
+      name: k8s-certs
+      readOnly: true
     - mountPath: /etc/ssl/certs
       name: ca-certs
+      readOnly: true
+    - mountPath: /etc/pki
+      name: etc-pki
+      readOnly: true
+    - mountPath: /usr/share/ca-certificates
+      name: usr-share-ca-certificates
       readOnly: true
     - mountPath: /etc/ca-certificates
       name: etc-ca-certificates
       readOnly: true
-    - mountPath: /etc/pki
-      name: etc-pki
-      readOnly: true
-    - mountPath: /etc/kubernetes/pki
-      name: k8s-certs
-      readOnly: true
-    - mountPath: /usr/share/ca-certificates
-      name: usr-share-ca-certificates
-      readOnly: true

Sorting Volumes and VolumeMounts should fix this issue and help
to avoid unnecessary upgrades.
2018-10-19 18:22:47 +03:00
Ed Bartosh
ad0179897d kubeadm: skip upgrade if manifest is not changed
When doing upgrades kubeadm generates new manifest and
waits until kubelet restarts correspondent pod.

However, kubelet won't restart pod if there are no changes
in the manifest. That makes kubeadm stuck waiting for
restarted pod.

Skipping upgrade if new component manifest is the same as
current manifest should solve this.

Fixes: kubernetes/kubeadm#1054
2018-10-17 11:07:51 +03:00
Andrew Rynhard
8f6ec989e0
Create control plane with ClusterFirstWithHostNet dns policy 2018-09-20 09:51:59 -07:00
fabriziopandini
7dfb3c7134 kubeadm config add support for more than one APIEndpoint 2018-08-27 09:00:26 +02:00
Lucas Käldström
5224551fa1 kubeadm: Split out ClusterConfiguration from InitConfiguration
Trivial rebasement, fixed some broken tests,
and inserted some TODOs: Rostislav M. Georgiev <rostislavg@vmware.com>
2018-08-22 11:43:02 +03:00
Lucas Käldström
52f0591ad9
Automated rename from MasterConfiguration to InitConfiguration 2018-07-09 04:55:02 +03:00
leigh schrandt
76c04b9b13 kubeadm: When etcd is listening on all interfaces, set the etcd probe to use loopback
Fixes https://github.com/kubernetes/kubeadm/issues/882
2018-06-05 18:33:56 -06:00
Lucas Käldström
099e60b1db
kubeadm: Refactor the .Etcd substruct in the v1alpha2 API 2018-05-23 21:13:32 +03:00
Timothy St. Clair
465094f32b Add 'system-cluster-critical" to kubeadm control plane pods. 2018-05-10 13:58:12 -05:00
leigh schrandt
3b45b021ee [kubeadm] Implement ReadStaticPodFromDisk 2018-04-20 18:32:04 -06:00
leigh schrandt
9bbf3fd539 Update liveness probes to exec etcdctl /w mTLS for kubeadm etcd static pods 2018-03-04 19:25:19 -07:00
test
a3fb9b4443
kubeadm: use localhost for API server liveness probe 2018-02-23 18:02:36 -08:00
Daneyon Hansen
1d47893608 Adds Support for Configurable Kubeadm Probes. 2017-11-03 10:42:29 -07:00
Andrew Rynhard
5a64c049e6
Allow extra volumes to be defined 2017-10-31 21:44:45 -07:00
Di Xu
01e4b960d8 update kubeadm to use hostpath type 2017-08-24 21:11:52 +08:00
Lucas Käldström
4a693337b6
kubeadm: Add back labels for the Static Pod control plane (attempt 2) 2017-08-19 19:59:59 +03:00
fabriziopandini
4db581c8ee Move all staticpod utils to separate package 2017-08-14 16:30:31 +02:00