Go to file
Patrick Ohly 21d1bcd6b8 initialize logging after flag parsing
It wasn't documented that InitLogs already uses the log flush frequency, so
some commands have called it before parsing (for example, kubectl in the
original code for logs.go). The flag never had an effect in such commands.

Fixing this turned into a major refactoring of how commands set up flags and
run their Cobra command:

- component-base/logs: implicitely registering flags during package init is an
  anti-pattern that makes it impossible to use the package in commands which
  want full control over their command line. Logging flags must be added
  explicitly now, something that the new cli.Run does automatically.

- component-base/logs: AddFlags would have crashed in kubectl-convert if it
  had been called because it relied on the global pflag.CommandLine. This
  has been fixed and kubectl-convert now has the same --log-flush-frequency
  flag as other commands.

- component-base/logs/testinit: an exception are tests where flag.CommandLine has
  to be used. This new package can be imported to add flags to that
  once per test program.

- Normalization of the klog command line flags was inconsistent. Some commands
  unintentionally didn't normalize to the recommended format with hyphens. This
  gets fixed for sample programs, but not for production programs because
  it would be a breaking change.

This refactoring has the following user-visible effects:

- The validation error for `go run ./cmd/kube-apiserver --logging-format=json
  --add-dir-header` now references `add-dir-header` instead of `add_dir_header`.

- `staging/src/k8s.io/cloud-provider/sample` uses flags with hyphen instead of
  underscore.

- `--log-flush-frequency` is not listed anymore in the --logging-format flag's
  `non-default formats don't honor these flags` usage text because it will also
  work for non-default formats once it is needed.

- `cmd/kubelet`: the description of `--logging-format` uses hyphens instead of
  underscores for the flags, which now matches what the command is using.

- `staging/src/k8s.io/component-base/logs/example/cmd`: added logging flags.

- `apiextensions-apiserver` no longer prints a useless stack trace for `main`
  when command line parsing raises an error.
2021-09-30 13:46:49 +02:00
.github adding sig info to test issue templates 2021-09-22 12:41:15 +05:30
api move IPv6DualStack feature to stable. (#104691) 2021-09-24 16:30:22 -07:00
build Merge pull request #105158 from justaugustus/its-a-bullseye 2021-09-26 23:14:23 -07:00
CHANGELOG Improve formatting in CHANGELOGs 2021-09-17 10:07:14 +03:00
cluster Revert "Use docker buildx for etcd image" 2021-09-27 10:46:17 -07:00
cmd initialize logging after flag parsing 2021-09-30 13:46:49 +02:00
docs hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
hack Merge pull request #105171 from liggitt/gomodule-staticcheck 2021-09-21 10:34:23 -07:00
LICENSES klog 2.20.0, logr v1.1.0, zapr v1.1.0 2021-09-09 14:43:43 +02:00
logo Create colors.md 2021-01-15 22:15:43 -08:00
pkg initialize logging after flag parsing 2021-09-30 13:46:49 +02:00
plugin PodSecurity: add admission benchmark 2021-09-21 16:20:11 -04:00
staging initialize logging after flag parsing 2021-09-30 13:46:49 +02:00
test initialize logging after flag parsing 2021-09-30 13:46:49 +02:00
third_party Copy golang license to staging copies 2021-08-10 17:37:28 -04:00
vendor initialize logging after flag parsing 2021-09-30 13:46:49 +02:00
.generated_files Purge almost all memories of godep 2020-05-07 21:49:00 -07:00
.gitattributes review staging go.mod files 2019-05-10 15:40:43 -04:00
.gitignore Rename _examples to examples 2021-01-25 10:20:46 -08:00
CHANGELOG.md CHANGELOG: Move changelog, soft-link to top-level, refresh listing 2020-02-06 01:04:44 -05:00
code-of-conduct.md Update code-of-conduct.md 2017-12-20 13:33:36 -05:00
CONTRIBUTING.md Remove stale analytics links from docs 2020-11-18 07:04:48 -06:00
go.mod Updated vendor files and pinned versions 2021-09-13 15:42:42 +05:30
go.sum Updated vendor files and pinned versions 2021-09-13 15:42:42 +05:30
LICENSE
Makefile
Makefile.generated_files
OWNERS Move brendandburns to to emeritus status. 2020-08-27 10:20:56 -04:00
OWNERS_ALIASES storage: update OWNERS and ALIASES 2021-09-13 07:54:25 +02:00
README.md Update godoc reference widget to pkg.go.dev 2021-01-26 09:34:07 -05:00
SECURITY_CONTACTS Update SECURITY_CONTACTS with current PSC 2019-05-29 15:22:35 +05:30
SUPPORT.md delete all duplicate empty blanks 2019-02-23 10:28:04 +08:00

Kubernetes (K8s)

GoPkg Widget CII Best Practices


Kubernetes, also known as K8s, is an open source system for managing containerized applications across multiple hosts. It provides basic mechanisms for deployment, maintenance, and scaling of applications.

Kubernetes builds upon a decade and a half of experience at Google running production workloads at scale using a system called Borg, combined with best-of-breed ideas and practices from the community.

Kubernetes is hosted by the Cloud Native Computing Foundation (CNCF). If your company wants to help shape the evolution of technologies that are container-packaged, dynamically scheduled, and microservices-oriented, consider joining the CNCF. For details about who's involved and how Kubernetes plays a role, read the CNCF announcement.


To start using K8s

See our documentation on kubernetes.io.

Try our interactive tutorial.

Take a free course on Scalable Microservices with Kubernetes.

To use Kubernetes code as a library in other applications, see the list of published components. Use of the k8s.io/kubernetes module or k8s.io/kubernetes/... packages as libraries is not supported.

To start developing K8s

The community repository hosts all information about building Kubernetes from source, how to contribute code and documentation, who to contact about what, etc.

If you want to build Kubernetes right away there are two options:

You have a working Go environment.
mkdir -p $GOPATH/src/k8s.io
cd $GOPATH/src/k8s.io
git clone https://github.com/kubernetes/kubernetes
cd kubernetes
make
You have a working Docker environment.
git clone https://github.com/kubernetes/kubernetes
cd kubernetes
make quick-release

For the full story, head over to the developer's documentation.

Support

If you need support, start with the troubleshooting guide, and work your way through the process that we've outlined.

That said, if you have questions, reach out to us one way or another.