Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

kola/tests: add kubernetes static pod test #910

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mike-nguyen
Copy link
Member

This is a basic smoke test to ensure a node can handle static pods on
RHCOS. The test configures the static pod through ignition (drops in
kubelet configuration, static pod definition, and kubelet unit file).

kola/tests/kubernetes/kubelet.go Outdated Show resolved Hide resolved
"systemd": {
"units": [
{
"contents": "[Unit]\nDescription=Kubernetes Kubelet\nRequires=docker.service\nAfter=docker.service\n\n[Service]\nExecStart=/usr/bin/hyperkube \\\n kubelet \\\n --config /etc/kubernetes/kubeletconfig\n\nRestart=always\nRestartSec=10\n\n[Install]\nWantedBy=multi-user.target\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note, this and below assume kubelet is using docker (and that the host has docker at all) - so it'll need some adaption for Fedora CoreOS at least, and shortly RHCOS isn't going to use Docker either. But for now we can do this, just let's keep in mind it'll (hopefully shortly) need to change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reduced the verification down to a curl command that doesn't depend on the the container runtime. I left docker in the kubelet unit file though.

"files": [
{
"contents": {
"source": "data:,kind%3A%20KubeletConfiguration%0AapiVersion%3A%20kubelet.config.k8s.io%2Fv1beta1%0AclusterDomain%3A%20kube.local%0AclusterDNS%3A%20%5B10.254.0.10%5D%0AcgroupDriver%3A%20systemd%0AstaticPodPath%3A%20%2Fetc%2Fkubernetes%2Fmanifests%2F%0Aauthorization%3A%0A%20%20mode%3A%20AlwaysAllow%0Aauthentication%3A%0A%20%20anonymous%3A%0A%20%20%20%20enabled%3A%20true%0A%20%20webhook%3A%0A%20%20%20%20enabled%3A%20false%0A",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you translate these into english for review at least? @sjennings should review this, to make sure it looks like the bootstrap config we are going to use.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kind: KubeletConfiguration
apiVersion: kubelet.config.k8s.io/v1beta1
clusterDomain: kube.local
clusterDNS: [10.254.0.10]
cgroupDriver: systemd
staticPodPath: /etc/kubernetes/manifests/
authorization:
  mode: AlwaysAllow
authentication:
  anonymous:
    enabled: true
  webhook:
    enabled: false

I noticed https://github.com/openshift/installer/blob/master/modules/ignition/resources/services/kubelet.service but kubelet in RHCOS is running 1.11 which uses a a kubeletconfiguration file for most of the options. If there is already an existing kubeletconfiguration, let me know so I can use that instead of the one I created.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kind: KubeletConfiguration
apiVersion: kubelet.config.k8s.io/v1beta1
clusterDomain: kube.local
clusterDNS: [10.254.0.10]
cgroupDriver: systemd
staticPodPath: /etc/kubernetes/manifests/
authorization:
  mode: AlwaysAllow
authentication:
  anonymous:
    enabled: true
  webhook:
    enabled: false

currently our manifest dir is /etc/origin/node/pods. might change that to match.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if 4.0 is switching to a kubelet, and the isntaller is going to use /etc/kubernetes/manifests like upstream, I think we should take this change to just abandon /etc/origin/node/pods....

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll keep it as is if that is the destination going forward. Is there anything else that sticks out in terms of the kubeletconfiguration? I created it based on the API with the least amount of options to get it working.

@mike-nguyen
Copy link
Member Author

Pushed some new changes:

  • Readable YAML / Unit / Ignition files
  • Changed the validation to use curl instead of docker to check the nginx static pod is running. I still could not remove docker from the unit file but we can cross that bridge later.

"github.com/coreos/mantle/platform/conf"
"github.com/coreos/mantle/util"

"github.com/vincent-petithory/dataurl"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please re-order the imports to match the rest of the files?

stdlib imports

external imports

internal imports (in mantle)

@mike-nguyen
Copy link
Member Author

Docker was dropped from RHCOS so I'll be re-working the test to run on crio.

This is a basic smoke test to ensure a node can handle static pods on
RHCOS.  The test configures the static pod through ignition (drops in
kubelet configuration, static pod definition, and kubelet unit file).

Since there can be different container runtimes, the test verify that
nginx is running on port 80 using curl.
@mike-nguyen
Copy link
Member Author

Switched over to using CRI-O / runc but will need cni fix/workaround [0] for the port forward to work.

[0] cri-o/cri-o#1804

@arithx
Copy link
Contributor

arithx commented Oct 10, 2018

Is this still blocked?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants