Comments (5)
As an alternative, this script is hideous but functional:
deprecated_apis=(
networkpolicy,networking.k8s.io/v1
podsecuritypolicy,policy/v1beta1
daemonset,apps/v1beta2
deployment,apps/v1
statefulset,apps/v1
replicaset,apps/v1
)
for d in "${deprecated_apis[@]}"; do
api=$(echo $d | cut -d, -f1)
version=$(echo $d | cut -d, -f2)
echo "===== These ${api} objects to be upgraded to \"${version}\""
kubectl get $api -A -o json | jq -r ".items[] | select(.apiVersion != \"$version\") | \"\(.metadata.name) \(.metadata.namespace)\""
done
from kube-no-trouble.
Hi @evanstucker-hates-2fa, thanks for reporting this, but I think this might be a false alarm. It's not quite how kubent works. If you request a resource from K8s API, you can get it in different API versions, based on how your client requested it. This, however, is not related to how the resource was created. E.g. you create a NetworkPolicy using networking.k8s.io/v1
, and when you call kubectl get
you can get it back as extensions/v1beta1
.
This is why the collectors use various "tricks", such as reading kubectl.kubernetes.io/last-applied-configuration
annotation, to get the version that was used to create the resource.
You can see this by actually requesting the full version, in your case compare:
kubectl get networkpolicies.v1.networking.k8s.io redis -o jsonpath='{.apiVersion}'
vs
kubectl get networkpolicies.v1beta1.extensions redis -o jsonpath='{.apiVersion}'
I would like to verify this is indeed the case. Can you please share full manifest of one of the resources you mentioned (if these were created using kubectl)?
from kube-no-trouble.
Sneaky! Thanks for the explanation. You can close this issue.
from kube-no-trouble.
Yeah, here's what I'm seeing:
root@codefi-us-east-2:/mnt$ kubectl get networkpolicies.v1.networking.k8s.io redis -o jsonpath='{.apiVersion}'; echo
networking.k8s.io/v1
root@codefi-us-east-2:/mnt$ kubectl get networkpolicies.v1beta1.extensions redis -o jsonpath='{.apiVersion}'; echo
extensions/v1beta1
from kube-no-trouble.
Ok great, thank you for confirming 👍 , I'll close the issue. If you check the original manifest, or the kubectl.kubernetes.io/last-applied-configuration
if present, it should confirm that the non-deprecated (networking.k8s.io/v1
) API version was used to create the resource.
from kube-no-trouble.
Related Issues (20)
- panic: interface conversion: interface {} is nil, not string HOT 3
- Multi Tenant Shared EKS cluster HOT 3
- Entries appear that are not in config HOT 5
- Multiple additional kinds of the same resource are not respected HOT 2
- Failure to retrieve AKS cluster resources - kubelogin not found HOT 1
- PodSecurityPolicy Deprecation Not Detected HOT 4
- Skip already removed APIs HOT 2
- Add FAQ explaining potential false positives HOT 7
- Depreciation api call triggered in the kubernetes migration notification window HOT 2
- New release HOT 3
- Missing kubectl.kubernetes.io/last-applied-configuration Annotation in Kubernetes Resources and Inclusion in kubectl Reports HOT 2
- WRN failed to discover supported resources for policy/v1beta1 HOT 3
- Feature request - validate helm charts HOT 2
- kubeconfig context feature does not work in 0.7.1 version HOT 1
- Autofix using a --fix or --autofix flag HOT 2
- Distinguish between deprecated / removed apis in CI mode error code HOT 2
- Kubent cause AWS EKS upgrade warning HOT 4
- Helm charts scanning for deprecated APIs HOT 2
- Missing kubernetes 1.28 deprecations HOT 3
- Unable to give multiple manifest files for scanning HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kube-no-trouble.